// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/mksimtape/mksimtape.c
// Function: main
INT main(INT argc, PCHAR argv[])
{	BOOL rc = TRUE;
	INT i, bs;
	PCHAR p;

	progname = strrchr(argv[0], '/');
	if(progname == (PCHAR) NULL) progname = argv[0]; else progname++;

	if(argc == 1) {
		error("at least one file must be specified", argv[0]);
		putusage();
		exit(EXIT_FAILURE);
	}

	for(i = 1; i < argc; i++) {
		bs = DEFBLKSIZE;
		p = strchr(argv[i], ':');
		if(p != (PCHAR) NULL) {
			*p = '\0';
			bs = strtol(++p, (CHAR **) NULL, 10);
			if(bs == 0) {
				error("block size for file '%s' is invalid",
					argv[i]);
				rc = FALSE;
				break;
			}
		}
		write_file(argv[i], bs);
		tape_mark();
	}

	tape_mark();

	return(rc == TRUE ? EXIT_SUCCESS : EXIT_FAILURE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
movl %edi, %ebp
movq (%rsi), %rbx
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x1070
leaq 0x1(%rax), %rcx
testq %rax, %rax
cmoveq %rbx, %rcx
movq %rcx, 0x2d27(%rip)      # 0x40a8
cmpl $0x1, %ebp
je 0x15c0
jle 0x158f
movl %ebp, %eax
movq %rax, 0x20(%rsp)
movb $0x1, %bl
movl $0x1, %ebp
movq %r12, 0x18(%rsp)
movq (%r12,%rbp,8), %r15
movq %r15, %rdi
movl $0x3a, %esi
callq 0x1060
movl $0x2800, %r13d          # imm = 0x2800
testq %rax, %rax
je 0x13e4
movb $0x0, (%rax)
incq %rax
movq %rax, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
movq %rax, %r13
movq (%r12,%rbp,8), %r15
testl %r13d, %r13d
je 0x15a7
leal 0x1(%r13), %eax
movslq %eax, %rbx
andq $-0x2, %rbx
movl %r13d, 0xc(%rsp)
movq 0x2bf5(%rip), %rax      # 0x3ff0
movq (%rax), %rdi
cmpl %r13d, %ebx
leaq 0xc6b(%rip), %r8        # 0x2073
leaq 0xcf9(%rip), %rax       # 0x2108
cmoveq %rax, %r8
leaq 0xc32(%rip), %rsi       # 0x204c
movq %r15, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x10a0
movq %r15, %rdi
leaq 0xc86(%rip), %rsi       # 0x20b6
callq 0x10e0
testq %rax, %rax
je 0x1557
movq %rax, %r14
movq %r15, 0x10(%rsp)
movq %rbx, %rdi
callq 0x10d0
testq %rax, %rax
je 0x156a
movq %rax, %r15
movq %rbp, 0x28(%rsp)
movslq %r13d, %rax
movq %rax, 0x30(%rsp)
movl $0x1, %esi
movq %r15, %rdi
movq 0x30(%rsp), %rdx
movq %r14, %rcx
callq 0x1040
movq %rax, %rbp
movl %r13d, %r12d
subl %ebp, %r12d
jle 0x14af
movq %r14, %rdi
callq 0x10b0
testl %eax, %eax
je 0x157a
testl %ebp, %ebp
je 0x1525
movslq %ebp, %rdi
addq %r15, %rdi
movslq %r12d, %rdx
xorl %esi, %esi
callq 0x1080
cmpl %r13d, %ebx
je 0x14ba
movb $0x0, -0x1(%r15,%rbx)
movq 0x2b0f(%rip), %r12      # 0x3fd0
movq (%r12), %rcx
movl $0x1, %esi
movl $0x4, %edx
leaq 0xc(%rsp), %rdi
callq 0x1110
cmpl $0x4, %eax
jne 0x1517
movq (%r12), %rcx
movl $0x1, %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x1110
cmpl %eax, %ebx
jg 0x1517
movq (%r12), %rcx
movl $0x1, %esi
movl $0x4, %edx
leaq 0xc(%rsp), %rdi
callq 0x1110
cmpl $0x4, %eax
je 0x1467
leaq 0xbb2(%rip), %rdi       # 0x20d0
xorl %eax, %eax
callq 0x1130
movq %r15, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1050
movq 0x18(%rsp), %r12
movq 0x28(%rsp), %rbp
callq 0x15e0
incq %rbp
cmpq 0x20(%rsp), %rbp
setb %bl
jne 0x13a3
jmp 0x158f
leaq 0xb22(%rip), %rdi       # 0x2080
movq %r15, %rsi
xorl %eax, %eax
callq 0x1130
jmp 0x153f
leaq 0xb25(%rip), %rdi       # 0x2096
xorl %eax, %eax
callq 0x1130
jmp 0x153f
leaq 0xb37(%rip), %rdi       # 0x20b8
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x1130
jmp 0x1525
xorl %ebx, %ebx
callq 0x15e0
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa7a(%rip), %rdi       # 0x2028
movq %r15, %rsi
xorl %eax, %eax
callq 0x1130
movzbl %bl, %ebx
andl $0x1, %ebx
jmp 0x1591
leaq 0xa3d(%rip), %rdi       # 0x2004
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1130
callq 0x11f5
movl $0x1, %edi
callq 0x1100