// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0xb0, %rsp
xorl %eax, %eax
callq 0xaa8d
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x332c
movaps 0x111bd(%rip), %xmm0    # 0x157e0
leaq 0x80(%rsp), %r8
movaps %xmm0, 0x10(%r8)
movaps 0x11199(%rip), %xmm0    # 0x157d0
movaps %xmm0, (%r8)
movw $0x57, 0x20(%r8)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
leaq 0x18(%rsp), %rbx
leaq 0x5c(%rsp), %rdx
pushq $0x22
popq %rcx
movl $0xd1ba, %esi           # imm = 0xD1BA
movq %rbx, %rdi
callq 0xb68f
xorl %eax, %eax
callq 0xada8
cmpq $0x0, 0x10(%rbx)
jne 0x4701
cmpq $0x0, 0x38(%rsp)
jne 0x4720
cmpq $0x0, 0x30(%rsp)
jne 0x473f
cmpq $0x0, 0x40(%rsp)
jne 0x475e
cmpq $0x20, 0x18(%rsp)
jne 0x477d
movq 0x20(%rsp), %rax
xorl %ecx, %ecx
cmpq $0x1f, %rcx
je 0x46e2
cmpb $0x0, (%rax,%rcx)
leaq 0x1(%rcx), %rcx
je 0x46b3
leaq 0xcf06(%rip), %rdi      # 0x115d0
leaq 0xc97f(%rip), %rsi      # 0x11050
leaq 0xce7f(%rip), %rcx      # 0x11557
movl $0x300, %edx            # imm = 0x300
callq 0x3040
cmpb $0x7, 0x1f(%rax)
jne 0x479c
cmpq $0x0, 0x48(%rsp)
jne 0x47bb
addq $0xb0, %rsp
popq %rbx
retq
leaq 0xc927(%rip), %rdi      # 0x1102f
leaq 0xc941(%rip), %rsi      # 0x11050
leaq 0xce41(%rip), %rcx      # 0x11557
movl $0x2fa, %edx            # imm = 0x2FA
callq 0x3040
leaq 0xce46(%rip), %rdi      # 0x1156d
leaq 0xc922(%rip), %rsi      # 0x11050
leaq 0xce22(%rip), %rcx      # 0x11557
movl $0x2fb, %edx            # imm = 0x2FB
callq 0x3040
leaq 0xce48(%rip), %rdi      # 0x1158e
leaq 0xc903(%rip), %rsi      # 0x11050
leaq 0xce03(%rip), %rcx      # 0x11557
movl $0x2fc, %edx            # imm = 0x2FC
callq 0x3040
leaq 0xce4a(%rip), %rdi      # 0x115af
leaq 0xc8e4(%rip), %rsi      # 0x11050
leaq 0xcde4(%rip), %rcx      # 0x11557
movl $0x2fd, %edx            # imm = 0x2FD
callq 0x3040
leaq 0xc9c3(%rip), %rdi      # 0x11147
leaq 0xc8c5(%rip), %rsi      # 0x11050
leaq 0xcdc5(%rip), %rcx      # 0x11557
movl $0x2fe, %edx            # imm = 0x2FE
callq 0x3040
leaq 0xce4f(%rip), %rdi      # 0x115f2
leaq 0xc8a6(%rip), %rsi      # 0x11050
leaq 0xcda6(%rip), %rcx      # 0x11557
movl $0x302, %edx            # imm = 0x302
callq 0x3040
leaq 0xc953(%rip), %rdi      # 0x11115
leaq 0xc887(%rip), %rsi      # 0x11050
leaq 0xcd87(%rip), %rcx      # 0x11557
movl $0x303, %edx            # imm = 0x303
callq 0x3040