// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
xorl %eax, %eax
callq 0xca7b
movq $-0x2, %r14
leaq 0x18(%rsp), %r15
leaq 0xf47d(%rip), %r12      # 0x14050
movq 0x1941e(%rip), %r13     # 0x1dff8
leaq 0x124dc(%rip), %rbx     # 0x170bd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x4c08
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x4bfc
addb $-0x57, %cl
jmp 0x4c06
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x4c46
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x4c2d
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x4c21
addb $-0x57, %cl
jmp 0x4c2b
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x4c5b
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x4be1
jmp 0x4c6f
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x4c08
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x4c2d
leaq 0x12bca(%rip), %rsi     # 0x17840
leaq 0x80(%rsp), %rbx
movl $0x16a, %edx            # imm = 0x16A
movq %rbx, %rdi
callq 0x30b0
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movdqu 0x18(%rsp), %xmm0
movdqu %xmm0, (%rsp)
leaq 0x30(%rsp), %r14
leaq 0x74(%rsp), %rdx
movl $0x18cb5, %esi          # imm = 0x18CB5
movl $0x16a, %ecx            # imm = 0x16A
movq %r14, %rdi
movq %rbx, %r8
callq 0xd845
cmpq $0xe0, (%r14)
jne 0x4d6c
cmpq $0x0, 0x30(%rsp)
je 0x4d31
leaq 0x38(%rsp), %rbx
xorl %r14d, %r14d
leaq 0x12ccf(%rip), %r15     # 0x179b0
movq 0x38(%rsp), %rax
movdqu (%rax,%r14), %xmm0
movdqu 0x10(%rax,%r14), %xmm1
movdqu (%r14,%r15), %xmm2
pcmpeqb %xmm0, %xmm2
movdqu 0x10(%r14,%r15), %xmm0
pcmpeqb %xmm1, %xmm0
pand %xmm2, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x4d24
addq $0x20, %r14
cmpq 0x30(%rsp), %r14
jb 0x4ce1
jmp 0x4d31
movq %r14, %rdi
movq %rbx, %rsi
callq 0x31b8
jmp 0x4d17
movq 0x38(%rsp), %rdi
leaq 0x12c73(%rip), %rsi     # 0x179b0
movl $0xe0, %edx
callq 0x30d0
testl %eax, %eax
jne 0x4d8b
cmpq $0x0, 0x60(%rsp)
jne 0x4daa
xorl %eax, %eax
callq 0xcf29
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf602(%rip), %rdi      # 0x14375
leaq 0xf322(%rip), %rsi      # 0x1409c
leaq 0xf754(%rip), %rcx      # 0x144d5
movl $0x1e1, %edx            # imm = 0x1E1
callq 0x3040
leaq 0xf61e(%rip), %rdi      # 0x143b0
leaq 0xf303(%rip), %rsi      # 0x1409c
leaq 0xf735(%rip), %rcx      # 0x144d5
movl $0x1ef, %edx            # imm = 0x1EF
callq 0x3040
leaq 0xf3b0(%rip), %rdi      # 0x14161
leaq 0xf2e4(%rip), %rsi      # 0x1409c
leaq 0xf716(%rip), %rcx      # 0x144d5
movl $0x1f0, %edx            # imm = 0x1F0
callq 0x3040