// File: /workspace/github_c_makefile_star2_O0/minoki[P]icfpc2006/run_directthreaded_tailcall.c
// Function: main
int main(int argc, char *argv[])
{
    if (argc <= 1) {
        fprintf(stderr, "Usage: %s file.um\n", argv[0]);
        return 1;
    }
    void *rawprogram = NULL;
    size_t rawprogsize = 0;
    {
        FILE *f = fopen(argv[1], "rb");
        assert(f != NULL);
        int seekresult = fseek(f, 0, SEEK_END);
        assert(seekresult == 0);
        long size = ftell(f);
        assert(size >= 0);
        rawprogsize = size;
        seekresult = fseek(f, 0, SEEK_SET);
        assert(seekresult == 0);
        rawprogram = malloc(rawprogsize);
        assert(rawprogram != NULL);
        size_t result = fread(rawprogram, 1, rawprogsize, f);
        assert(result == rawprogsize);
        fclose(f);
    }
    assert(rawprogsize % 4 == 0);
    struct array *prog = malloc(sizeof(uint32_t) + rawprogsize);
    assert(prog != NULL);
    prog->length = rawprogsize / 4;
    {
        uint8_t *rawprogram_ = (uint8_t *)rawprogram;
        for (size_t i = 0; i < rawprogsize / 4; ++i) {
            uint32_t a = (uint32_t)rawprogram_[4 * i];
            uint32_t b = (uint32_t)rawprogram_[4 * i + 1];
            uint32_t c = (uint32_t)rawprogram_[4 * i + 2];
            uint32_t d = (uint32_t)rawprogram_[4 * i + 3];
            prog->data[i] = (a << 24) | (b << 16) | (c << 8) | d;
        }
        free(rawprogram);
    }
    fprintf(stderr, "Loaded program. size=%zu bytes\n", rawprogsize);
    arr = calloc(1, sizeof(struct array *));
    arr[0] = prog;
    recalc();
    program[0](0, arr[0]);
}

// Assembly:
subq $0x68, %rsp
movl $0x0, 0x64(%rsp)
movl %edi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
cmpl $0x1, 0x60(%rsp)
jg 0x2159
movq 0x2ebd(%rip), %rax      # 0x4ff0
movq (%rax), %rdi
movq 0x58(%rsp), %rax
movq (%rax), %rdx
leaq 0x110f(%rip), %rsi      # 0x3254
movb $0x0, %al
callq 0x10c0
movl $0x1, 0x64(%rsp)
jmp 0x24a2
movq $0x0, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x10ec(%rip), %rsi      # 0x3267
callq 0x1130
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x218f
jmp 0x21ae
leaq 0x10d4(%rip), %rdi      # 0x326a
leaq 0xe73(%rip), %rsi       # 0x3010
movl $0x11c, %edx            # imm = 0x11C
leaq 0x10cb(%rip), %rcx      # 0x3274
callq 0x1080
movq 0x40(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x1110
movl %eax, 0x3c(%rsp)
cmpl $0x0, 0x3c(%rsp)
jne 0x21ce
jmp 0x21ed
leaq 0x10b6(%rip), %rdi      # 0x328b
leaq 0xe34(%rip), %rsi       # 0x3010
movl $0x11e, %edx            # imm = 0x11E
leaq 0x108c(%rip), %rcx      # 0x3274
callq 0x1080
movq 0x40(%rsp), %rdi
callq 0x10d0
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jl 0x2206
jmp 0x2225
leaq 0x108e(%rip), %rdi      # 0x329b
leaq 0xdfc(%rip), %rsi       # 0x3010
movl $0x120, %edx            # imm = 0x120
leaq 0x1054(%rip), %rcx      # 0x3274
callq 0x1080
movq 0x30(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x40(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x1110
movl %eax, 0x3c(%rsp)
cmpl $0x0, 0x3c(%rsp)
jne 0x224c
jmp 0x226b
leaq 0x1038(%rip), %rdi      # 0x328b
leaq 0xdb6(%rip), %rsi       # 0x3010
movl $0x123, %edx            # imm = 0x123
leaq 0x100e(%rip), %rcx      # 0x3274
callq 0x1080
movq 0x48(%rsp), %rdi
callq 0x10f0
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
je 0x2284
jmp 0x22a3
leaq 0x101a(%rip), %rdi      # 0x32a5
leaq 0xd7e(%rip), %rsi       # 0x3010
movl $0x125, %edx            # imm = 0x125
leaq 0xfd6(%rip), %rcx       # 0x3274
callq 0x1080
movq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %rcx
movl $0x1, %esi
callq 0x1060
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x48(%rsp), %rax
jne 0x22cf
jmp 0x22ee
leaq 0xfe2(%rip), %rdi       # 0x32b8
leaq 0xd33(%rip), %rsi       # 0x3010
movl $0x127, %edx            # imm = 0x127
leaq 0xf8b(%rip), %rcx       # 0x3274
callq 0x1080
movq 0x40(%rsp), %rdi
callq 0x1070
movq 0x48(%rsp), %rax
andq $0x3, %rax
cmpq $0x0, %rax
jne 0x2309
jmp 0x2328
leaq 0xfbe(%rip), %rdi       # 0x32ce
leaq 0xcf9(%rip), %rsi       # 0x3010
movl $0x12a, %edx            # imm = 0x12A
leaq 0xf51(%rip), %rcx       # 0x3274
callq 0x1080
movq 0x48(%rsp), %rdi
addq $0x4, %rdi
callq 0x10f0
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x2345
jmp 0x2364
leaq 0xf97(%rip), %rdi       # 0x32e3
leaq 0xcbd(%rip), %rsi       # 0x3010
movl $0x12c, %edx            # imm = 0x12C
leaq 0xf15(%rip), %rcx       # 0x3274
callq 0x1080
movq 0x48(%rsp), %rax
shrq $0x2, %rax
movl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x48(%rsp), %rcx
shrq $0x2, %rcx
cmpq %rcx, %rax
jae 0x2437
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
shlq $0x2, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
shlq $0x2, %rcx
movzbl 0x1(%rax,%rcx), %eax
movl %eax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
shlq $0x2, %rcx
movzbl 0x2(%rax,%rcx), %eax
movl %eax, 0x4(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
shlq $0x2, %rcx
movzbl 0x3(%rax,%rcx), %eax
movl %eax, (%rsp)
movl 0xc(%rsp), %edx
shll $0x18, %edx
movl 0x8(%rsp), %eax
shll $0x10, %eax
orl %eax, %edx
movl 0x4(%rsp), %eax
shll $0x8, %eax
orl %eax, %edx
orl (%rsp), %edx
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movl %edx, 0x4(%rax,%rcx,4)
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x2389
movq 0x50(%rsp), %rdi
callq 0x1030
movq 0x2ba8(%rip), %rax      # 0x4ff0
movq (%rax), %rdi
movq 0x48(%rsp), %rdx
leaq 0xe99(%rip), %rsi       # 0x32f0
movb $0x0, %al
callq 0x10c0
movl $0x1, %edi
movl $0x8, %esi
callq 0x10a0
movq %rax, 0x2c9c(%rip)      # 0x5110
movq 0x20(%rsp), %rcx
movq 0x2c90(%rip), %rax      # 0x5110
movq %rcx, (%rax)
callq 0x1f80
movq 0x2c79(%rip), %rax      # 0x5108
movq (%rax), %rax
movq 0x2c77(%rip), %rcx      # 0x5110
movq (%rcx), %rsi
xorl %ecx, %ecx
movl %ecx, %edi
callq *%rax
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq