#include <stdio.h>

int main ( void ) {
	int x;
	while( x != 3) {
		printf( "\n Type \n 1 to enter filenames < 20 in length \n 2 for 2 \n 3 to quit \n: " );
		scanf( "%d", &x );
		switch( x ){
			case 1:
				char spikVec[ 20 ], confVec[ 20 ], spikTransMat[ 20 ];

				printf( " Please enter spiking vector file: \n" );
				scanf( " %s", &spikVec );
				printf( " Please enter configuration vector file: \n" );
				scanf( " %s", &confVec );
				printf( " Please enter spiking transition matrix file: \n" );
				scanf( " %s", &spikTransMat ); 
				if( ( strlen( spikVec ) ) > 20 && ( strlen( confVec ) ) > 20 && ( strlen( spikTransMat ) ) > 20  ) {
					printf( " Filename/s was/were too long ( > 20 char )  " );
					// Do something about segmentation fault here
					//spikVec = { "\0" }; // doesn't work
					//*confVec = NULL; // doesn't work 
				}
				else {
					printf( " You entered the file %s for the spiking vector \n", spikVec );
					printf( " You entered the file %s for the configuration vector \n", confVec );
					printf( " You entered the file %s for the spiking transition matrix \n ", spikTransMat );
				}
				break;
			case 2: 
				printf( " You entered 2 \n" );
				break;
			case 3: 
				printf( " You entered quit. Bye! \n" );
				break;
			default:
				printf( " You entered an invalid choice \n" );
				break;
		}

	}
}

	.file	"tmpxft_00286523_00000000-6_scanf.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2030:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"\n Type \n 1 to enter filenames < 20 in length \n 2 for 2 \n 3 to quit \n: "
.LC1:
	.string	"%d"
.LC2:
	.string	" Please enter spiking vector file: \n"
.LC3:
	.string	" %s"
.LC4:
	.string	" Please enter configuration vector file: \n"
.LC5:
	.string	" Please enter spiking transition matrix file: \n"
.LC6:
	.string	" You entered the file %s for the spiking vector \n"
.LC7:
	.string	" You entered the file %s for the configuration vector \n"
.LC8:
	.string	" You entered the file %s for the spiking transition matrix \n "
.LC9:
	.string	" You entered 2 \n"
.LC10:
	.string	" You entered quit. Bye! \n"
.LC11:
	.string	" You entered an invalid choice \n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$80, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
.L3:
	cmpl	$3, 8(%rsp)
	je	.L13
	movq	%r14, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movl	8(%rsp), %eax
	cmpl	$2, %eax
	je	.L4
	cmpl	$3, %eax
	je	.L5
	decl	%eax
	jne	.L6
	leaq	.LC3(%rip), %rbx
	leaq	12(%rsp), %r13
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	leaq	32(%rsp), %r12
	call	__printf_chk@PLT
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	52(%rsp), %rbp
	leaq	.LC5(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movq	%r13, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC6(%rip), %rsi
	call	__printf_chk@PLT
	movq	%r12, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC7(%rip), %rsi
	call	__printf_chk@PLT
	movq	%rbp, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC8(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L3
.L4:
	leaq	.LC9(%rip), %rsi
	jmp	.L11
.L5:
	leaq	.LC10(%rip), %rsi
	jmp	.L11
.L6:
	leaq	.LC11(%rip), %rsi
.L11:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L13:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	addq	$80, %rsp
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2053:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2053:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdio.h>

int main ( void ) {
	int x;
	while( x != 3) {
		printf( "\n Type \n 1 to enter filenames < 20 in length \n 2 for 2 \n 3 to quit \n: " );
		scanf( "%d", &x );
		switch( x ){
			case 1:
				char spikVec[ 20 ], confVec[ 20 ], spikTransMat[ 20 ];

				printf( " Please enter spiking vector file: \n" );
				scanf( " %s", &spikVec );
				printf( " Please enter configuration vector file: \n" );
				scanf( " %s", &confVec );
				printf( " Please enter spiking transition matrix file: \n" );
				scanf( " %s", &spikTransMat ); 
				if( ( strlen( spikVec ) ) > 20 && ( strlen( confVec ) ) > 20 && ( strlen( spikTransMat ) ) > 20  ) {
					printf( " Filename/s was/were too long ( > 20 char )  " );
					// Do something about segmentation fault here
					//spikVec = { "\0" }; // doesn't work
					//*confVec = NULL; // doesn't work 
				}
				else {
					printf( " You entered the file %s for the spiking vector \n", spikVec );
					printf( " You entered the file %s for the configuration vector \n", confVec );
					printf( " You entered the file %s for the spiking transition matrix \n ", spikTransMat );
				}
				break;
			case 2: 
				printf( " You entered 2 \n" );
				break;
			case 3: 
				printf( " You entered quit. Bye! \n" );
				break;
			default:
				printf( " You entered an invalid choice \n" );
				break;
		}

	}
}

	.text
	.file	"scanf.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
