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

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

    // 5f5b80156019575859525936fd5b6001565b80600d576001015b8060021160115700
    op_t program[] = {
        PUSH0,
        JUMPDEST,
        DUP1, ISZERO, PUSH1, 0x19, JUMPI,
        PC, MSIZE, MSTORE,
        MSIZE, CALLDATASIZE, REVERT,
        JUMPDEST,
        PUSH1, 0x01, JUMP,
        JUMPDEST,
        DUP1, PUSH1, 0x0d, JUMPI,
        PUSH1, 0x01, ADD,
        JUMPDEST,
        DUP1, PUSH1, 0x02, GT,
        PUSH1, 0x11, JUMPI,
        STOP,
    };

    input.size = sizeof(program);
    input.content = program;

    result_t result = txCreate(from, gas, value, input);
    evmFinalize();
    assert(UPPER(UPPER(result.status)) == 0);
    assert(UPPER(LOWER(result.status)) == 0);
    assert(LOWER(UPPER(result.status)) == 0);
    assert(LOWER(LOWER(result.status)) == 0);
    assert(result.returnData.size == 32);
    for (int i = 0; i < 31; i++) {
        assert(result.returnData.content[i] == 0);
    }
    assert(result.returnData.content[31] == 7);
    assert(result.gasRemaining == 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
xorl %eax, %eax
callq 0xca7b
movq $-0x2, %r14
leaq 0x18(%rsp), %r15
leaq 0xea52(%rip), %r12      # 0x14050
movq 0x189f3(%rip), %r13     # 0x1dff8
leaq 0x11ab1(%rip), %rbx     # 0x170bd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x5633
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x5627
addb $-0x57, %cl
jmp 0x5631
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x5671
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x5658
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x564c
addb $-0x57, %cl
jmp 0x5656
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x5686
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x560c
jmp 0x569a
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x5633
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x5658
movaps 0x1317f(%rip), %xmm0    # 0x18820
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x10(%r8)
movaps 0x1315b(%rip), %xmm0    # 0x18810
movaps %xmm0, (%r8)
movw $0x57, 0x20(%r8)
movl 0x28(%rsp), %eax
movl %eax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x30(%rsp), %rbx
leaq 0x74(%rsp), %rdx
movl $0xd1ba, %esi           # imm = 0xD1BA
movl $0x22, %ecx
movq %rbx, %rdi
callq 0xd845
xorl %eax, %eax
callq 0xcf29
cmpq $0x0, 0x10(%rbx)
jne 0x5791
cmpq $0x0, 0x50(%rsp)
jne 0x57b0
cmpq $0x0, 0x48(%rsp)
jne 0x57cf
cmpq $0x0, 0x58(%rsp)
jne 0x57ee
cmpq $0x20, 0x30(%rsp)
jne 0x580d
movq 0x38(%rsp), %rax
xorl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x5772
incq %rcx
cmpq $0x1f, %rcx
jne 0x5736
movq 0x38(%rsp), %rax
cmpb $0x7, 0x1f(%rax)
jne 0x582c
cmpq $0x0, 0x60(%rsp)
jne 0x584b
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xeea3(%rip), %rdi      # 0x1461c
leaq 0xe91c(%rip), %rsi      # 0x1409c
leaq 0xee1c(%rip), %rcx      # 0x145a3
movl $0x300, %edx            # imm = 0x300
callq 0x3040
leaq 0xe8e3(%rip), %rdi      # 0x1407b
leaq 0xe8fd(%rip), %rsi      # 0x1409c
leaq 0xedfd(%rip), %rcx      # 0x145a3
movl $0x2fa, %edx            # imm = 0x2FA
callq 0x3040
leaq 0xee02(%rip), %rdi      # 0x145b9
leaq 0xe8de(%rip), %rsi      # 0x1409c
leaq 0xedde(%rip), %rcx      # 0x145a3
movl $0x2fb, %edx            # imm = 0x2FB
callq 0x3040
leaq 0xee04(%rip), %rdi      # 0x145da
leaq 0xe8bf(%rip), %rsi      # 0x1409c
leaq 0xedbf(%rip), %rcx      # 0x145a3
movl $0x2fc, %edx            # imm = 0x2FC
callq 0x3040
leaq 0xee06(%rip), %rdi      # 0x145fb
leaq 0xe8a0(%rip), %rsi      # 0x1409c
leaq 0xeda0(%rip), %rcx      # 0x145a3
movl $0x2fd, %edx            # imm = 0x2FD
callq 0x3040
leaq 0xe97f(%rip), %rdi      # 0x14193
leaq 0xe881(%rip), %rsi      # 0x1409c
leaq 0xed81(%rip), %rcx      # 0x145a3
movl $0x2fe, %edx            # imm = 0x2FE
callq 0x3040
leaq 0xee0b(%rip), %rdi      # 0x1463e
leaq 0xe862(%rip), %rsi      # 0x1409c
leaq 0xed62(%rip), %rcx      # 0x145a3
movl $0x302, %edx            # imm = 0x302
callq 0x3040
leaq 0xe90f(%rip), %rdi      # 0x14161
leaq 0xe843(%rip), %rsi      # 0x1409c
leaq 0xed43(%rip), %rcx      # 0x145a3
movl $0x303, %edx            # imm = 0x303
callq 0x3040