// File: /workspace/github_c_makefile_star2_O0/jacereda[P]fsatrace/src/fsatest.c
// Function: main
int
main(int argc, const char *argv[])
{
	int trace = 0;
	int exitCode = 0;

	for (int i = 1; i < argc; i++) {
		const char *s = argv[i];
		FILE *	    fp;
		char *	    cmdline;
		int	    seconds;

		switch (s[0]) {
		case 'r':
			if (trace)
				printf("Reading from: %s\n", &s[1]);
			fp = fopen(&s[1], "r");
			while (fgetc(fp) != EOF)
				; // nothing
			fclose(fp);
			break;

		case 'w':
			if (trace)
				printf("Writing to: %s\n", &s[1]);
			fp = fopen(&s[1], "w");
			fputs("Written by fsatest harness\n", fp);
			fclose(fp);
			break;

		case 's':
			seconds = atoi(&s[i]);
			if (trace)
				printf("Sleeping for: %is\n", seconds);
			sleep(seconds);
			break;

		case 'f':
			if (trace)
				printf("Will return a failing exit code\n");
			exitCode = 1;
			break;

		case 'e':
			cmdline = strdup(&s[1]);
			unescape(cmdline);
			if (trace)
				printf("Running command: %s\n", cmdline);
			exec(cmdline);
			free(cmdline);
			break;

		default:
			printf("FAILED: Could not interpret command line: %s\n",
			    s);
			return 1;
		}
	}
	return exitCode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x157a
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
addl $-0x65, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x12, %eax
ja 0x154f
movq -0x48(%rbp), %rax
leaq 0xbf9(%rip), %rcx       # 0x2004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x14(%rbp)
je 0x1430
movq -0x28(%rbp), %rsi
addq $0x1, %rsi
leaq 0xc29(%rip), %rdi       # 0x2052
movb $0x0, %al
callq 0x1050
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
leaq 0xc25(%rip), %rsi       # 0x2064
callq 0x1090
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1070
cmpl $-0x1, %eax
je 0x1458
jmp 0x1448
movq -0x30(%rbp), %rdi
callq 0x1040
jmp 0x156a
cmpl $0x0, -0x14(%rbp)
je 0x1482
movq -0x28(%rbp), %rsi
addq $0x1, %rsi
leaq 0xbeb(%rip), %rdi       # 0x2066
movb $0x0, %al
callq 0x1050
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
leaq 0xbe5(%rip), %rsi       # 0x2076
callq 0x1090
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
leaq 0xbd3(%rip), %rdi       # 0x2078
callq 0x1060
movq -0x30(%rbp), %rdi
callq 0x1040
jmp 0x156a
movq -0x28(%rbp), %rdi
movslq -0x1c(%rbp), %rax
addq %rax, %rdi
callq 0x10c0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x14e2
movl -0x3c(%rbp), %esi
leaq 0xbb9(%rip), %rdi       # 0x2094
movb $0x0, %al
callq 0x1050
movl -0x3c(%rbp), %edi
callq 0x10e0
jmp 0x156a
cmpl $0x0, -0x14(%rbp)
je 0x1500
leaq 0xbae(%rip), %rdi       # 0x20a7
movb $0x0, %al
callq 0x1050
movl $0x1, -0x18(%rbp)
jmp 0x156a
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
callq 0x10d0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1200
cmpl $0x0, -0x14(%rbp)
je 0x153b
movq -0x38(%rbp), %rsi
leaq 0xb94(%rip), %rdi       # 0x20c8
movb $0x0, %al
callq 0x1050
movq -0x38(%rbp), %rdi
callq 0x12e0
movq -0x38(%rbp), %rdi
callq 0x1030
jmp 0x156a
movq -0x28(%rbp), %rsi
leaq 0xb83(%rip), %rdi       # 0x20dd
movb $0x0, %al
callq 0x1050
movl $0x1, -0x4(%rbp)
jmp 0x1580
jmp 0x156c
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x13cb
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq