// File: /workspace/github_c_makefile_star2_O3/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 0xca4d
movq $-0x2, %r14
leaq 0x18(%rsp), %r15
leaq 0xe97f(%rip), %r12      # 0x14070
movq 0x18900(%rip), %r13     # 0x1dff8
leaq 0x119de(%rip), %rbx     # 0x170dd
movzbl 0x4(%r14,%r12), %ecx
leal -0x30(%rcx), %ebp
cmpb $0xa, %bpl
jb 0x5726
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x571a
addb $-0x57, %cl
jmp 0x5724
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x5764
addb $-0x37, %cl
movl %ecx, %ebp
movzbl 0x5(%r14,%r12), %ecx
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x574b
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x573f
addb $-0x57, %cl
jmp 0x5749
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x5779
addb $-0x37, %cl
movl %ecx, %eax
shlb $0x4, %bpl
addb %al, %bpl
movb %bpl, (%r15)
addq $0x2, %r14
incq %r15
cmpq $0x26, %r14
jb 0x56ff
jmp 0x578d
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %bpl
jmp 0x5726
movq (%r13), %rdi
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x30a0
movb $-0x1, %al
jmp 0x574b
movaps 0x130ac(%rip), %xmm0    # 0x18840
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x10(%r8)
movaps 0x13088(%rip), %xmm0    # 0x18830
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 0xd683
xorl %eax, %eax
callq 0xcd49
cmpq $0x0, 0x10(%rbx)
jne 0x587f
cmpq $0x0, 0x50(%rsp)
jne 0x589e
cmpq $0x0, 0x48(%rsp)
jne 0x58bd
cmpq $0x0, 0x58(%rsp)
jne 0x58dc
cmpq $0x20, 0x30(%rsp)
jne 0x58fb
movq 0x38(%rsp), %rax
xorl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
jne 0x5860
incq %rcx
cmpq $0x1f, %rcx
jne 0x5829
cmpb $0x7, 0x1f(%rax)
jne 0x591a
cmpq $0x0, 0x60(%rsp)
jne 0x5939
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xedd5(%rip), %rdi      # 0x1463c
leaq 0xe84e(%rip), %rsi      # 0x140bc
leaq 0xed4e(%rip), %rcx      # 0x145c3
movl $0x300, %edx            # imm = 0x300
callq 0x3040
leaq 0xe815(%rip), %rdi      # 0x1409b
leaq 0xe82f(%rip), %rsi      # 0x140bc
leaq 0xed2f(%rip), %rcx      # 0x145c3
movl $0x2fa, %edx            # imm = 0x2FA
callq 0x3040
leaq 0xed34(%rip), %rdi      # 0x145d9
leaq 0xe810(%rip), %rsi      # 0x140bc
leaq 0xed10(%rip), %rcx      # 0x145c3
movl $0x2fb, %edx            # imm = 0x2FB
callq 0x3040
leaq 0xed36(%rip), %rdi      # 0x145fa
leaq 0xe7f1(%rip), %rsi      # 0x140bc
leaq 0xecf1(%rip), %rcx      # 0x145c3
movl $0x2fc, %edx            # imm = 0x2FC
callq 0x3040
leaq 0xed38(%rip), %rdi      # 0x1461b
leaq 0xe7d2(%rip), %rsi      # 0x140bc
leaq 0xecd2(%rip), %rcx      # 0x145c3
movl $0x2fd, %edx            # imm = 0x2FD
callq 0x3040
leaq 0xe8b1(%rip), %rdi      # 0x141b3
leaq 0xe7b3(%rip), %rsi      # 0x140bc
leaq 0xecb3(%rip), %rcx      # 0x145c3
movl $0x2fe, %edx            # imm = 0x2FE
callq 0x3040
leaq 0xed3d(%rip), %rdi      # 0x1465e
leaq 0xe794(%rip), %rsi      # 0x140bc
leaq 0xec94(%rip), %rcx      # 0x145c3
movl $0x302, %edx            # imm = 0x302
callq 0x3040
leaq 0xe841(%rip), %rdi      # 0x14181
leaq 0xe775(%rip), %rsi      # 0x140bc
leaq 0xec75(%rip), %rcx      # 0x145c3
movl $0x303, %edx            # imm = 0x303
callq 0x3040