// File: /workspace/github_c_makefile_star2_O1/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, %r14
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 0x15b7
setg %bl
jle 0x159d
movl %ebp, %eax
movq %rax, 0x20(%rsp)
movl $0x1, %ebp
movq %r14, 0x18(%rsp)
movq (%r14,%rbp,8), %rdi
movl $0x3a, %esi
callq 0x1060
movl $0x2800, %r12d          # imm = 0x2800
testq %rax, %rax
je 0x13de
movb $0x0, (%rax)
incq %rax
movq %rax, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
movq %rax, %r12
testl %r12d, %r12d
je 0x158b
movq (%r14,%rbp,8), %r15
leal 0x1(%r12), %eax
movslq %eax, %rbx
andq $-0x2, %rbx
movl %r12d, 0xc(%rsp)
movq 0x2bf6(%rip), %rax      # 0x3ff0
movq (%rax), %rdi
cmpl %r12d, %ebx
leaq 0xc6c(%rip), %r8        # 0x2073
leaq 0xcfa(%rip), %rax       # 0x2108
cmoveq %rax, %r8
leaq 0xc33(%rip), %rsi       # 0x204c
movq %r15, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x10a0
movq %r15, %rdi
leaq 0xc87(%rip), %rsi       # 0x20b6
callq 0x10e0
testq %rax, %rax
je 0x1553
movq %rax, %r13
movq %r15, 0x10(%rsp)
movq %rbx, %rdi
callq 0x10d0
testq %rax, %rax
je 0x1566
movq %rax, %r15
movq %rbp, 0x28(%rsp)
movslq %r12d, %rax
movq %rax, 0x30(%rsp)
movl $0x1, %esi
movq %r15, %rdi
movq 0x30(%rsp), %rdx
movq %r13, %rcx
callq 0x1040
movq %rax, %rbp
movl %r12d, %r14d
subl %ebp, %r14d
jle 0x14ae
movq %r13, %rdi
callq 0x10b0
testl %eax, %eax
je 0x1576
testl %ebp, %ebp
je 0x1521
movslq %ebp, %rdi
addq %r15, %rdi
movslq %r14d, %rdx
xorl %esi, %esi
callq 0x1080
cmpl %r12d, %ebx
je 0x14b9
movb $0x0, -0x1(%r15,%rbx)
movq 0x2b10(%rip), %r14      # 0x3fd0
movq (%r14), %rcx
movl $0x1, %esi
movl $0x4, %edx
leaq 0xc(%rsp), %rdi
callq 0x1110
cmpl $0x4, %eax
jne 0x1513
movq (%r14), %rcx
movl $0x1, %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x1110
cmpl %eax, %ebx
jg 0x1513
movq (%r14), %rcx
movl $0x1, %esi
movl $0x4, %edx
leaq 0xc(%rsp), %rdi
callq 0x1110
cmpl $0x4, %eax
je 0x1466
leaq 0xbb6(%rip), %rdi       # 0x20d0
xorl %eax, %eax
callq 0x1130
movq %r15, %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1050
movq 0x18(%rsp), %r14
movq 0x28(%rsp), %rbp
callq 0x15d7
incq %rbp
cmpq 0x20(%rsp), %rbp
setb %bl
jne 0x13a4
jmp 0x159d
leaq 0xb26(%rip), %rdi       # 0x2080
movq %r15, %rsi
xorl %eax, %eax
callq 0x1130
jmp 0x153b
leaq 0xb29(%rip), %rdi       # 0x2096
xorl %eax, %eax
callq 0x1130
jmp 0x153b
leaq 0xb3b(%rip), %rdi       # 0x20b8
movq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x1130
jmp 0x1521
movq (%r14,%rbp,8), %rsi
leaq 0xa92(%rip), %rdi       # 0x2028
xorl %eax, %eax
callq 0x1130
callq 0x15d7
movzbl %bl, %eax
andl $0x1, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa46(%rip), %rdi       # 0x2004
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1130
callq 0x11f5
movl $0x1, %edi
callq 0x1100