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

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

    // 600460090759527ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc600907595260047ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70759527ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff70759527f40000000000000000000000000000000000000000000000000000000000000007f80000000000000000000000000000000000000000000000000000000000000010759527f40000000000000000000000000000000000000000000000000000000000000007fc0000000000000000000000000000000000000000000000000000000000000010759527fc0000000000000000000000000000000000000000000000000000000000000007f8000000000000000000000000000000000000000000000000000000000000001075952595ff3
    op_t program[] = {
        PUSH1, 4, PUSH1, 9, SMOD, 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, SMOD, 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,
        SMOD, 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,
        SMOD, 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, 0x01,
        SMOD, 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, 0x01,
        SMOD, 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, 0x01,
        SMOD, 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, 0x01,
        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, 0x01,
        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,
        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,
        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, 0x01,
        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, 0x01,
        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, 0x01
    };
    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 0x16de7(%rip), %rsi     # 0x1b004
addq $0x2, %rsi
callq 0x3380
movq $0x18cb5, -0x20(%rbp)   # imm = 0x18CB5
leaq -0x1b0(%rbp), %rdi
leaq 0x1a5c4(%rip), %rsi     # 0x1e800
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 0x1a6d2(%rip), %rsi     # 0x1e970
movl $0xe0, %edx
callq 0x30c0
cmpq $0xe0, -0x1f0(%rbp)
jne 0x42b7
jmp 0x42d6
leaq 0x1706b(%rip), %rdi     # 0x1b329
leaq 0x16d8b(%rip), %rsi     # 0x1b050
movl $0x1e1, %edx            # imm = 0x1E1
leaq 0x171b8(%rip), %rcx     # 0x1b489
callq 0x3040
movq $0x0, -0x2d8(%rbp)
movq -0x2d8(%rbp), %rax
cmpq -0x1f0(%rbp), %rax
jae 0x4449
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 0x4430
movq 0x20ccd(%rip), %rax     # 0x24ff8
movq (%rax), %rdi
movq -0x2d8(%rbp), %rdx
leaq 0x17141(%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 0x43a6
movq 0x20c89(%rip), %rax     # 0x24ff8
movq (%rax), %rdi
movq -0x1e8(%rbp), %rax
movq -0x2e0(%rbp), %rcx
movzbl (%rax,%rcx), %edx
leaq 0x1ce09(%rip), %rsi     # 0x21194
movb $0x0, %al
callq 0x30b0
movq -0x2e0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2e0(%rbp)
jmp 0x4351
movq 0x20c4b(%rip), %rax     # 0x24ff8
movq (%rax), %rsi
leaq 0x170ce(%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 0x441c
movq 0x20c10(%rip), %rax     # 0x24ff8
movq (%rax), %rdi
movq -0x2e8(%rbp), %rax
movzbl -0x2d0(%rbp,%rax), %edx
leaq 0x1cd93(%rip), %rsi     # 0x21194
movb $0x0, %al
callq 0x30b0
movq -0x2e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2e8(%rbp)
jmp 0x43ca
movq 0x20bd5(%rip), %rax     # 0x24ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x3080
jmp 0x4432
movq -0x2d8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x2d8(%rbp)
jmp 0x42e1
movq -0x1e8(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
movl $0xe0, %edx
callq 0x3090
cmpl $0x0, %eax
jne 0x4468
jmp 0x4487
leaq 0x16ef5(%rip), %rdi     # 0x1b364
leaq 0x16bda(%rip), %rsi     # 0x1b050
movl $0x1ef, %edx            # imm = 0x1EF
leaq 0x17007(%rip), %rcx     # 0x1b489
callq 0x3040
cmpq $0x0, -0x1c0(%rbp)
jne 0x4493
jmp 0x44b2
leaq 0x16c7b(%rip), %rdi     # 0x1b115
leaq 0x16baf(%rip), %rsi     # 0x1b050
movl $0x1f0, %edx            # imm = 0x1F0
leaq 0x16fdc(%rip), %rcx     # 0x1b489
callq 0x3040
movb $0x0, %al
callq 0xd4d0
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
nopw %cs:(%rax,%rax)