// File: /workspace/github_c_makefile_star2_O0/wjmelements[P]evm/tst/evm.c
// Function: test_sdiv
void test_sdiv() {
    evmInit();

    address_t from = AddressFromHex42("0x4a6f6B9fF1fc974096f9063a45Fd12bD5B928AD1");
    uint64_t gas = 0x18c91;
    val_t value;
    data_t input;

    // 600460090559527ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc600905595260047ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70559527ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70559527f40000000000000000000000000000000000000000000000000000000000000007f80000000000000000000000000000000000000000000000000000000000000000559527f40000000000000000000000000000000000000000000000000000000000000007fc0000000000000000000000000000000000000000000000000000000000000000559527fc0000000000000000000000000000000000000000000000000000000000000007f8000000000000000000000000000000000000000000000000000000000000000055952595ff3
    op_t program[] = {
        PUSH1, 4, PUSH1, 9, SDIV, MSIZE, MSTORE,
        PUSH32,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
        PUSH1, 9, SDIV, MSIZE, MSTORE,
        PUSH1, 4,
        PUSH32,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7,
        SDIV, MSIZE, MSTORE,
        PUSH32,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
        PUSH32,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7,
        SDIV, MSIZE, MSTORE,
        PUSH32,
        0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        PUSH32,
        0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        SDIV, MSIZE, MSTORE,
        PUSH32,
        0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        PUSH32,
        0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        SDIV, MSIZE, MSTORE,
        PUSH32,
        0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        PUSH32,
        0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        SDIV, MSIZE, MSTORE,
        MSIZE, PUSH0, RETURN
    };
    input.size = sizeof(program);
    input.content = program;

    result_t result = txCreate(from, gas, value, input);

    op_t expected[] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
    };
    assert(result.returnData.size == sizeof(expected));
    for (size_t i = 0; i < result.returnData.size; i+=32) {
        if (memcmp(result.returnData.content+i, expected+i, 32)) {
            fprintf(stderr, "%zu:\n< ", i);
            for (size_t j = i; j < i + 32; j++) {
                fprintf(stderr, "%02x", result.returnData.content[j]);
            }
            fputs("\n> ", stderr);
            for (size_t j = i; j < i + 32; j++) {
                fprintf(stderr, "%02x", expected[j]);
            }
            fputc('\n', stderr);
        }
    }
    assert(memcmp(result.returnData.content, expected, sizeof(expected)) == 0);
    assert(result.gasRemaining == 0);

    evmFinalize();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movb $0x0, %al
callq 0xcfc0
leaq -0x18(%rbp), %rdi
leaq 0x170b7(%rip), %rsi     # 0x1b004
addq $0x2, %rsi
callq 0x3380
movq $0x18c91, -0x20(%rbp)   # imm = 0x18C91
leaq -0x1b0(%rbp), %rdi
leaq 0x1a644(%rip), %rsi     # 0x1e5b0
movl $0x16a, %edx            # imm = 0x16A
callq 0x30c0
movq $0x16a, -0x40(%rbp)     # imm = 0x16A
leaq -0x1b0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %r8
leaq -0x1f0(%rbp), %rdi
leaq -0x18(%rbp), %rax
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0xe270
leaq -0x2d0(%rbp), %rdi
leaq 0x1a752(%rip), %rsi     # 0x1e720
movl $0xe0, %edx
callq 0x30c0
cmpq $0xe0, -0x1f0(%rbp)
jne 0x3fe7
jmp 0x4006
leaq 0x1733b(%rip), %rdi     # 0x1b329
leaq 0x1705b(%rip), %rsi     # 0x1b050
movl $0x197, %edx            # imm = 0x197
leaq 0x1746b(%rip), %rcx     # 0x1b46c
callq 0x3040
movq $0x0, -0x2d8(%rbp)
movq -0x2d8(%rbp), %rax
cmpq -0x1f0(%rbp), %rax
jae 0x4179
movq -0x1e8(%rbp), %rdi
addq -0x2d8(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
addq -0x2d8(%rbp), %rsi
movl $0x20, %edx
callq 0x3090
cmpl $0x0, %eax
je 0x4160
movq 0x20f9d(%rip), %rax     # 0x24ff8
movq (%rax), %rdi
movq -0x2d8(%rbp), %rdx
leaq 0x17411(%rip), %rsi     # 0x1b47d
movb $0x0, %al
callq 0x30b0
movq -0x2d8(%rbp), %rax
movq %rax, -0x2e0(%rbp)
movq -0x2e0(%rbp), %rax
movq -0x2d8(%rbp), %rcx
addq $0x20, %rcx
cmpq %rcx, %rax
jae 0x40d6
movq 0x20f59(%rip), %rax     # 0x24ff8
movq (%rax), %rdi
movq -0x1e8(%rbp), %rax
movq -0x2e0(%rbp), %rcx
movzbl (%rax,%rcx), %edx
leaq 0x1d0d9(%rip), %rsi     # 0x21194
movb $0x0, %al
callq 0x30b0
movq -0x2e0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2e0(%rbp)
jmp 0x4081
movq 0x20f1b(%rip), %rax     # 0x24ff8
movq (%rax), %rsi
leaq 0x1739e(%rip), %rdi     # 0x1b485
callq 0x3050
movq -0x2d8(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movq -0x2e8(%rbp), %rax
movq -0x2d8(%rbp), %rcx
addq $0x20, %rcx
cmpq %rcx, %rax
jae 0x414c
movq 0x20ee0(%rip), %rax     # 0x24ff8
movq (%rax), %rdi
movq -0x2e8(%rbp), %rax
movzbl -0x2d0(%rbp,%rax), %edx
leaq 0x1d063(%rip), %rsi     # 0x21194
movb $0x0, %al
callq 0x30b0
movq -0x2e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2e8(%rbp)
jmp 0x40fa
movq 0x20ea5(%rip), %rax     # 0x24ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x3080
jmp 0x4162
movq -0x2d8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x2d8(%rbp)
jmp 0x4011
movq -0x1e8(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
movl $0xe0, %edx
callq 0x3090
cmpl $0x0, %eax
jne 0x4198
jmp 0x41b7
leaq 0x171c5(%rip), %rdi     # 0x1b364
leaq 0x16eaa(%rip), %rsi     # 0x1b050
movl $0x1a5, %edx            # imm = 0x1A5
leaq 0x172ba(%rip), %rcx     # 0x1b46c
callq 0x3040
cmpq $0x0, -0x1c0(%rbp)
jne 0x41c3
jmp 0x41e2
leaq 0x16f4b(%rip), %rdi     # 0x1b115
leaq 0x16e7f(%rip), %rsi     # 0x1b050
movl $0x1a6, %edx            # imm = 0x1A6
leaq 0x1728f(%rip), %rcx     # 0x1b46c
callq 0x3040
movb $0x0, %al
callq 0xd4d0
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
nopw %cs:(%rax,%rax)