// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0xe0, %rsp
xorl %eax, %eax
callq 0xaa8d
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0x332c
leaq 0x1085a(%rip), %rsi     # 0x14130
pushq $0x51
popq %rax
leaq 0x80(%rsp), %r8
movq %rax, %rcx
movq %r8, %rdi
rep  movsb (%rsi), %es:(%rdi)
movl 0x10(%rbx), %ecx
movl %ecx, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
leaq 0x18(%rsp), %rbx
leaq 0x5c(%rsp), %rdx
movl $0x10650, %esi          # imm = 0x10650
movq %rbx, %rdi
movq %rax, %rcx
callq 0xb68f
xorl %eax, %eax
callq 0xada8
cmpq $0x0, 0x10(%rbx)
jne 0x39bd
movl $0x80d9b122, %eax       # imm = 0x80D9B122
cmpq %rax, 0x30(%rsp)
jne 0x39dc
movabsq $-0x23c5e9023be06931, %rax # imm = 0xDC3A16FDC41F96CF
cmpq %rax, 0x38(%rsp)
jne 0x39fb
movabsq $0x10ffe7e38d227c3, %rax # imm = 0x10FFE7E38D227C3
cmpq %rax, 0x40(%rsp)
jne 0x3a1a
cmpq $0x40, 0x18(%rsp)
jne 0x3a39
movq 0x20(%rsp), %rbx
leaq 0x81(%rsp), %rsi
pushq $0x20
popq %rdx
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
jne 0x3a58
addq $0x20, %rbx
leaq 0xa2(%rsp), %rsi
pushq $0x20
popq %rdx
movq %rbx, %rdi
callq 0x30d0
testl %eax, %eax
jne 0x3a77
cmpq $0x0, 0x48(%rsp)
jne 0x3a96
addq $0xe0, %rsp
popq %rbx
retq
leaq 0xd66b(%rip), %rdi      # 0x1102f
leaq 0xd685(%rip), %rsi      # 0x11050
leaq 0xd9d5(%rip), %rcx      # 0x113a7
movl $0xc1, %edx
callq 0x3040
leaq 0xd688(%rip), %rdi      # 0x1106b
leaq 0xd666(%rip), %rsi      # 0x11050
leaq 0xd9b6(%rip), %rcx      # 0x113a7
movl $0xc2, %edx
callq 0x3040
leaq 0xd693(%rip), %rdi      # 0x11095
leaq 0xd647(%rip), %rsi      # 0x11050
leaq 0xd997(%rip), %rcx      # 0x113a7
movl $0xc3, %edx
callq 0x3040
leaq 0xd6a6(%rip), %rdi      # 0x110c7
leaq 0xd628(%rip), %rsi      # 0x11050
leaq 0xd978(%rip), %rcx      # 0x113a7
movl $0xc4, %edx
callq 0x3040
leaq 0xd97b(%rip), %rdi      # 0x113bb
leaq 0xd609(%rip), %rsi      # 0x11050
leaq 0xd959(%rip), %rcx      # 0x113a7
movl $0xc5, %edx
callq 0x3040
leaq 0xd705(%rip), %rdi      # 0x11164
leaq 0xd5ea(%rip), %rsi      # 0x11050
leaq 0xd93a(%rip), %rcx      # 0x113a7
movl $0xc6, %edx
callq 0x3040
leaq 0xd95a(%rip), %rdi      # 0x113d8
leaq 0xd5cb(%rip), %rsi      # 0x11050
leaq 0xd91b(%rip), %rcx      # 0x113a7
movl $0xc7, %edx
callq 0x3040
leaq 0xd678(%rip), %rdi      # 0x11115
leaq 0xd5ac(%rip), %rsi      # 0x11050
leaq 0xd8fc(%rip), %rcx      # 0x113a7
movl $0xc8, %edx
callq 0x3040