// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x2f
popq %rsi
movq %rbx, %rdi
callq 0x1070
leaq 0x1(%rax), %rcx
testq %rax, %rax
cmoveq %rbx, %rcx
movq %rcx, 0x2e59(%rip)      # 0x40a8
cmpl $0x1, %ebp
je 0x149a
movslq %ebp, %r13
pushq $0x1
popq %rbx
pushq $0x3a
popq %r15
cmpq %r13, %rbx
jge 0x1479
movq (%r14,%rbx,8), %rbp
movq %rbp, %rdi
movl %r15d, %esi
callq 0x1060
testq %rax, %rax
je 0x1445
movb $0x0, (%rax)
incq %rax
movq %rax, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x10c0
movq %rax, %r12
movq (%r14,%rbx,8), %rbp
testl %r12d, %r12d
je 0x1468
movq %rbx, 0x18(%rsp)
leal 0x1(%r12), %eax
movslq %eax, %rbx
andq $-0x2, %rbx
movl %r12d, 0xc(%rsp)
movq 0x2d2d(%rip), %rax      # 0x3ff0
movq (%rax), %rdi
cmpl %r12d, %ebx
leaq 0xda3(%rip), %r8        # 0x2073
leaq 0xe31(%rip), %rax       # 0x2108
cmoveq %rax, %r8
leaq 0xd6a(%rip), %rsi       # 0x204c
movq %rbp, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x10a0
movq %rbp, %rdi
leaq 0xdbe(%rip), %rsi       # 0x20b6
callq 0x10e0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x140e
movq %rbx, %rdi
callq 0x10d0
testq %rax, %rax
je 0x1421
movq %rax, %r15
movq %r13, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movslq %r12d, %rax
movq %rax, 0x30(%rsp)
pushq $0x1
popq %r14
movq %r15, %rdi
movq %r14, %rsi
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq 0x1040
movq %rax, %r14
movl %r12d, %r13d
subl %r14d, %r13d
jle 0x1380
movq 0x10(%rsp), %rdi
callq 0x10b0
testl %eax, %eax
je 0x1455
testl %r14d, %r14d
je 0x13f0
movslq %r14d, %rdi
addq %r15, %rdi
movslq %r13d, %rdx
xorl %esi, %esi
callq 0x1080
cmpl %r12d, %ebx
je 0x138b
movb $0x0, -0x1(%r15,%rbx)
movq 0x2c3e(%rip), %r13      # 0x3fd0
movq (%r13), %rcx
leaq 0xc(%rsp), %rdi
pushq $0x1
popq %r14
movq %r14, %rsi
pushq $0x4
popq %rdx
callq 0x1110
cmpl $0x4, %eax
jne 0x13e2
movq (%r13), %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1110
cmpl %eax, %ebx
jg 0x13e2
movq (%r13), %rcx
leaq 0xc(%rsp), %rdi
movq %r14, %rsi
pushq $0x4
popq %rdx
callq 0x1110
cmpl $0x4, %eax
je 0x1335
leaq 0xce7(%rip), %rdi       # 0x20d0
xorl %eax, %eax
callq 0x14b8
movq %r15, %rdi
callq 0x1030
movq 0x10(%rsp), %rdi
callq 0x1050
movq 0x28(%rsp), %r14
movq 0x20(%rsp), %r13
jmp 0x142f
leaq 0xc6b(%rip), %rdi       # 0x2080
movq %rbp, %rsi
xorl %eax, %eax
callq 0x14b8
jmp 0x1433
leaq 0xc6e(%rip), %rdi       # 0x2096
xorl %eax, %eax
callq 0x14b8
pushq $0x3a
popq %r15
callq 0x15dc
movq 0x18(%rsp), %rbx
incq %rbx
jmp 0x1262
movq %rbx, 0x18(%rsp)
movl $0x2800, %r12d          # imm = 0x2800
jmp 0x12ab
leaq 0xc5c(%rip), %rdi       # 0x20b8
movq %rbp, %rsi
xorl %eax, %eax
callq 0x14b8
jmp 0x13f0
leaq 0xbb9(%rip), %rdi       # 0x2028
movq %rbp, %rsi
xorl %eax, %eax
callq 0x14b8
movq %rbx, %rax
xorl %ebx, %ebx
cmpq %r13, %rax
setl %bl
callq 0x15dc
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb63(%rip), %rdi       # 0x2004
movq %rbx, %rsi
xorl %eax, %eax
callq 0x14b8
callq 0x157d
pushq $0x1
popq %rdi
callq 0x1100