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

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

    op_t program[] = {
        PUSH32, // b
        0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe,
        0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01,
        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
        PUSH32, // a
        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
        0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01,
        0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe,
        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
        DUP2, XOR, // a ^= b
        SWAP1, DUP2, XOR, SWAP1, // b ^= a
        DUP2, XOR, // a ^= b
        MSIZE, MSTORE,
        MSIZE, MSTORE,
        MSIZE, PUSH0, RETURN,
    };

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

    result_t result = txCreate(from, gas, value, input);
    evmFinalize();
    assert(UPPER(UPPER(result.status)) == 0);
    assert(LOWER(UPPER(result.status)) == 0x80d9b122);
    assert(UPPER(LOWER(result.status)) == 0xdc3a16fdc41f96cf);
    assert(LOWER(LOWER(result.status)) == 0x010ffe7e38d227c3);
    assert(result.returnData.size == 64);
    assert(0 == memcmp(result.returnData.content, program + 1, 32));
    assert(0 == memcmp(result.returnData.content + 32, program + 34, 32));
    assert(result.gasRemaining == 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movb $0x0, %al
callq 0xcfc0
leaq -0x18(%rbp), %rdi
leaq 0x17527(%rip), %rsi     # 0x1b004
addq $0x2, %rsi
callq 0x3380
movq $0x10650, -0x20(%rbp)   # imm = 0x10650
leaq -0xa0(%rbp), %rdi
leaq 0x1a634(%rip), %rsi     # 0x1e130
movl $0x51, %edx
callq 0x30c0
movq $0x51, -0x40(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %r8
leaq -0xe0(%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
movb $0x0, %al
callq 0xd4d0
cmpq $0x0, -0xd0(%rbp)
jne 0x3b63
jmp 0x3b82
leaq 0x174c5(%rip), %rdi     # 0x1b02f
leaq 0x174df(%rip), %rsi     # 0x1b050
movl $0xc1, %edx
leaq 0x1782a(%rip), %rcx     # 0x1b3a7
callq 0x3040
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, -0xc8(%rbp)
jne 0x3b92
jmp 0x3bb1
leaq 0x174d2(%rip), %rdi     # 0x1b06b
leaq 0x174b0(%rip), %rsi     # 0x1b050
movl $0xc2, %edx
leaq 0x177fb(%rip), %rcx     # 0x1b3a7
callq 0x3040
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, -0xc0(%rbp)
jne 0x3bc6
jmp 0x3be5
leaq 0x174c8(%rip), %rdi     # 0x1b095
leaq 0x1747c(%rip), %rsi     # 0x1b050
movl $0xc3, %edx
leaq 0x177c7(%rip), %rcx     # 0x1b3a7
callq 0x3040
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, -0xb8(%rbp)
jne 0x3bfa
jmp 0x3c19
leaq 0x174c6(%rip), %rdi     # 0x1b0c7
leaq 0x17448(%rip), %rsi     # 0x1b050
movl $0xc4, %edx
leaq 0x17793(%rip), %rcx     # 0x1b3a7
callq 0x3040
cmpq $0x40, -0xe0(%rbp)
jne 0x3c25
jmp 0x3c44
leaq 0x1778f(%rip), %rdi     # 0x1b3bb
leaq 0x1741d(%rip), %rsi     # 0x1b050
movl $0xc5, %edx
leaq 0x17768(%rip), %rcx     # 0x1b3a7
callq 0x3040
movq -0xd8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
addq $0x1, %rsi
movl $0x20, %edx
callq 0x3090
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3c6a
jmp 0x3c89
leaq 0x174f3(%rip), %rdi     # 0x1b164
leaq 0x173d8(%rip), %rsi     # 0x1b050
movl $0xc6, %edx
leaq 0x17723(%rip), %rcx     # 0x1b3a7
callq 0x3040
movq -0xd8(%rbp), %rdi
addq $0x20, %rdi
leaq -0xa0(%rbp), %rsi
addq $0x22, %rsi
movl $0x20, %edx
callq 0x3090
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3cb3
jmp 0x3cd2
leaq 0x1771e(%rip), %rdi     # 0x1b3d8
leaq 0x1738f(%rip), %rsi     # 0x1b050
movl $0xc7, %edx
leaq 0x176da(%rip), %rcx     # 0x1b3a7
callq 0x3040
cmpq $0x0, -0xb0(%rbp)
jne 0x3cde
jmp 0x3cfd
leaq 0x17430(%rip), %rdi     # 0x1b115
leaq 0x17364(%rip), %rsi     # 0x1b050
movl $0xc8, %edx
leaq 0x176af(%rip), %rcx     # 0x1b3a7
callq 0x3040
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)