// File: /workspace/github_c_makefile_star2_O1/wjmelements[P]evm/tst/uint256.c
// Function: test_bitwise
void test_bitwise() {
    uint256_t a, b, c, d;

    LOWER(LOWER(a)) = 2ull;
    UPPER(LOWER(a)) = 3ull << 8;
    LOWER(UPPER(a)) = 5ull << 16;
    UPPER(UPPER(a)) = 7ull << 24;

    LOWER(LOWER(b)) = 11ull << 32;
    UPPER(LOWER(b)) = (13ull << 40) + (7ull << 8);
    LOWER(UPPER(b)) = 17ull << 48;
    UPPER(UPPER(b)) = 19ull << 56;

    LOWER(LOWER(c)) = 23ull;
    UPPER(LOWER(c)) = 29ull;
    LOWER(UPPER(c)) = 31ull;
    UPPER(UPPER(c)) = 37ull;

    and256(&a, &b, &d);
    assert((LOWER(LOWER(a)) & LOWER(LOWER(b))) == LOWER(LOWER(d)));
    assert((UPPER(LOWER(a)) & UPPER(LOWER(b))) == UPPER(LOWER(d)));
    assert((LOWER(UPPER(a)) & LOWER(UPPER(b))) == LOWER(UPPER(d)));
    assert((UPPER(UPPER(a)) & UPPER(UPPER(b))) == UPPER(UPPER(d)));

    and256(&a, &c, &d);
    assert((LOWER(LOWER(a)) & LOWER(LOWER(c))) == LOWER(LOWER(d)));
    assert((UPPER(LOWER(a)) & UPPER(LOWER(c))) == UPPER(LOWER(d)));
    assert((LOWER(UPPER(a)) & LOWER(UPPER(c))) == LOWER(UPPER(d)));
    assert((UPPER(UPPER(a)) & UPPER(UPPER(c))) == UPPER(UPPER(d)));

    or256(&a, &b, &d);
    assert((LOWER(LOWER(a)) | LOWER(LOWER(b))) == LOWER(LOWER(d)));
    assert((UPPER(LOWER(a)) | UPPER(LOWER(b))) == UPPER(LOWER(d)));
    assert((LOWER(UPPER(a)) | LOWER(UPPER(b))) == LOWER(UPPER(d)));
    assert((UPPER(UPPER(a)) | UPPER(UPPER(b))) == UPPER(UPPER(d)));

    or256(&a, &c, &d);
    assert((LOWER(LOWER(a)) | LOWER(LOWER(c))) == LOWER(LOWER(d)));
    assert((UPPER(LOWER(a)) | UPPER(LOWER(c))) == UPPER(LOWER(d)));
    assert((LOWER(UPPER(a)) | LOWER(UPPER(c))) == LOWER(UPPER(d)));
    assert((UPPER(UPPER(a)) | UPPER(UPPER(c))) == UPPER(UPPER(d)));

    xor256(&a, &b, &d);
    assert((LOWER(LOWER(a)) ^ LOWER(LOWER(b))) == LOWER(LOWER(d)));
    assert((UPPER(LOWER(a)) ^ UPPER(LOWER(b))) == UPPER(LOWER(d)));
    assert((LOWER(UPPER(a)) ^ LOWER(UPPER(b))) == LOWER(UPPER(d)));
    assert((UPPER(UPPER(a)) ^ UPPER(UPPER(b))) == UPPER(UPPER(d)));

    xor256(&a, &c, &d);
    assert((LOWER(LOWER(a)) ^ LOWER(LOWER(c))) == LOWER(LOWER(d)));
    assert((UPPER(LOWER(a)) ^ UPPER(LOWER(c))) == UPPER(LOWER(d)));
    assert((LOWER(UPPER(a)) ^ LOWER(UPPER(c))) == LOWER(UPPER(d)));
    assert((UPPER(UPPER(a)) ^ UPPER(UPPER(c))) == UPPER(UPPER(d)));

    xor256(&a, &b, &a);
    xor256(&a, &b, &b);
    xor256(&a, &b, &a);
    assert(LOWER(LOWER(b)) == 2ull);
    assert(UPPER(LOWER(b)) == 3ull << 8);
    assert(LOWER(UPPER(b)) == 5ull << 16);
    assert(UPPER(UPPER(b)) == 7ull << 24);
    assert(LOWER(LOWER(a)) == 11ull << 32);
    assert(UPPER(LOWER(a)) == (13ull << 40) + (7ull << 8));
    assert(LOWER(UPPER(a)) == 17ull << 48);
    assert(UPPER(UPPER(a)) == 19ull << 56);

    clear256(&d);
    assert(LOWER(LOWER(d)) == 0);
    assert(UPPER(LOWER(d)) == 0);
    assert(LOWER(UPPER(d)) == 0);
    assert(UPPER(UPPER(d)) == 0);

    assert(!zero256(&a));
    assert(!zero256(&b));
    assert(!zero256(&c));
    assert(zero256(&d));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movabsq $0x1300000000000000, %rax # imm = 0x1300000000000000
movabsq $0x11000000000000, %r13 # imm = 0x11000000000000
movabsq $0xd0000000700, %rbp    # imm = 0xD0000000700
movabsq $0xb00000000, %r12      # imm = 0xB00000000
leaq 0x8(%rsp), %rbx
movq $0x2, 0x18(%rbx)
movq $0x300, 0x10(%rbx)      # imm = 0x300
movq $0x50000, 0x8(%rbx)     # imm = 0x50000
movq $0x7000000, (%rbx)      # imm = 0x7000000
leaq 0x68(%rsp), %r14
movq %r12, 0x18(%r14)
movq %rbp, 0x10(%r14)
movq %r13, 0x8(%r14)
movq %rax, (%r14)
movq $0x17, 0x60(%rsp)
movq $0x1d, 0x58(%rsp)
movq $0x1f, 0x50(%rsp)
movq $0x25, 0x48(%rsp)
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4080
movq 0x18(%r14), %rax
andq 0x18(%rbx), %rax
cmpq 0x18(%r15), %rax
jne 0x15a3
movq 0x78(%rsp), %rax
andq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x15c2
movq 0x70(%rsp), %rax
andq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x15e1
movq 0x68(%rsp), %rax
andq 0x8(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x1600
leaq 0x8(%rsp), %rbx
leaq 0x48(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4080
movq 0x18(%r14), %rax
andq 0x18(%rbx), %rax
cmpq 0x18(%r15), %rax
jne 0x161f
movq 0x58(%rsp), %rax
andq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x163e
movq 0x50(%rsp), %rax
andq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x165d
movq 0x48(%rsp), %rax
andq 0x8(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x167c
leaq 0x8(%rsp), %rbx
leaq 0x68(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3fde
movq 0x18(%r14), %rax
orq 0x18(%rbx), %rax
cmpq 0x18(%r15), %rax
jne 0x169b
movq 0x78(%rsp), %rax
orq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x16ba
movq 0x70(%rsp), %rax
orq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x16d9
movq 0x68(%rsp), %rax
orq 0x8(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x16f8
leaq 0x8(%rsp), %rbx
leaq 0x48(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3fde
movq 0x18(%r14), %rax
orq 0x18(%rbx), %rax
cmpq 0x18(%r15), %rax
jne 0x1717
movq 0x58(%rsp), %rax
orq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x1736
movq 0x50(%rsp), %rax
orq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x1755
movq 0x48(%rsp), %rax
orq 0x8(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x1774
leaq 0x8(%rsp), %rbx
leaq 0x68(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x40c4
movq 0x18(%r14), %rax
xorq 0x18(%rbx), %rax
cmpq 0x18(%r15), %rax
jne 0x1793
movq 0x78(%rsp), %rax
xorq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x17b2
movq 0x70(%rsp), %rax
xorq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x17d1
movq 0x68(%rsp), %rax
xorq 0x8(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x17f0
leaq 0x8(%rsp), %rbx
leaq 0x48(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x40c4
movq 0x18(%r14), %rax
xorq 0x18(%rbx), %rax
cmpq 0x18(%r15), %rax
jne 0x180f
movq 0x58(%rsp), %rax
xorq 0x18(%rsp), %rax
cmpq 0x38(%rsp), %rax
jne 0x182e
movq 0x50(%rsp), %rax
xorq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jne 0x184d
movq 0x48(%rsp), %rax
xorq 0x8(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x186c
leaq 0x68(%rsp), %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x40c4
movq %r14, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x40c4
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x40c4
cmpq $0x2, 0x18(%rbx)
jne 0x188b
cmpq $0x300, 0x78(%rsp)      # imm = 0x300
jne 0x18aa
cmpq $0x50000, 0x70(%rsp)    # imm = 0x50000
jne 0x18c9
cmpq $0x7000000, 0x68(%rsp)  # imm = 0x7000000
jne 0x18e8
cmpq %r12, 0x20(%rsp)
jne 0x1907
cmpq %rbp, 0x18(%rsp)
jne 0x1926
cmpq %r13, 0x10(%rsp)
jne 0x1945
movabsq $0x1300000000000000, %rax # imm = 0x1300000000000000
cmpq %rax, 0x8(%rsp)
jne 0x1964
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x33ce
cmpq $0x0, 0x18(%rbx)
jne 0x1983
cmpq $0x0, 0x38(%rsp)
jne 0x19a2
cmpq $0x0, 0x30(%rsp)
jne 0x19c1
cmpq $0x0, 0x28(%rsp)
jne 0x19e0
leaq 0x8(%rsp), %rdi
callq 0x333a
testb %al, %al
jne 0x19ff
leaq 0x68(%rsp), %rdi
callq 0x333a
testb %al, %al
jne 0x1a1e
leaq 0x48(%rsp), %rdi
callq 0x333a
testb %al, %al
jne 0x1a3d
leaq 0x28(%rsp), %rdi
callq 0x333a
testb %al, %al
je 0x1a5c
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a96(%rip), %rdi      # 0x6040
leaq 0x4ac6(%rip), %rsi      # 0x6077
leaq 0x4acd(%rip), %rcx      # 0x6085
movl $0x1a, %edx
callq 0x1030
leaq 0x4ad0(%rip), %rdi      # 0x6099
leaq 0x4aa7(%rip), %rsi      # 0x6077
leaq 0x4aae(%rip), %rcx      # 0x6085
movl $0x1b, %edx
callq 0x1030
leaq 0x4ae8(%rip), %rdi      # 0x60d0
leaq 0x4a88(%rip), %rsi      # 0x6077
leaq 0x4a8f(%rip), %rcx      # 0x6085
movl $0x1c, %edx
callq 0x1030
leaq 0x4b00(%rip), %rdi      # 0x6107
leaq 0x4a69(%rip), %rsi      # 0x6077
leaq 0x4a70(%rip), %rcx      # 0x6085
movl $0x1d, %edx
callq 0x1030
leaq 0x4b18(%rip), %rdi      # 0x613e
leaq 0x4a4a(%rip), %rsi      # 0x6077
leaq 0x4a51(%rip), %rcx      # 0x6085
movl $0x20, %edx
callq 0x1030
leaq 0x4b30(%rip), %rdi      # 0x6175
leaq 0x4a2b(%rip), %rsi      # 0x6077
leaq 0x4a32(%rip), %rcx      # 0x6085
movl $0x21, %edx
callq 0x1030
leaq 0x4b48(%rip), %rdi      # 0x61ac
leaq 0x4a0c(%rip), %rsi      # 0x6077
leaq 0x4a13(%rip), %rcx      # 0x6085
movl $0x22, %edx
callq 0x1030
leaq 0x4b60(%rip), %rdi      # 0x61e3
leaq 0x49ed(%rip), %rsi      # 0x6077
leaq 0x49f4(%rip), %rcx      # 0x6085
movl $0x23, %edx
callq 0x1030
leaq 0x4b78(%rip), %rdi      # 0x621a
leaq 0x49ce(%rip), %rsi      # 0x6077
leaq 0x49d5(%rip), %rcx      # 0x6085
movl $0x26, %edx
callq 0x1030
leaq 0x4b90(%rip), %rdi      # 0x6251
leaq 0x49af(%rip), %rsi      # 0x6077
leaq 0x49b6(%rip), %rcx      # 0x6085
movl $0x27, %edx
callq 0x1030
leaq 0x4ba8(%rip), %rdi      # 0x6288
leaq 0x4990(%rip), %rsi      # 0x6077
leaq 0x4997(%rip), %rcx      # 0x6085
movl $0x28, %edx
callq 0x1030
leaq 0x4bc0(%rip), %rdi      # 0x62bf
leaq 0x4971(%rip), %rsi      # 0x6077
leaq 0x4978(%rip), %rcx      # 0x6085
movl $0x29, %edx
callq 0x1030
leaq 0x4bd8(%rip), %rdi      # 0x62f6
leaq 0x4952(%rip), %rsi      # 0x6077
leaq 0x4959(%rip), %rcx      # 0x6085
movl $0x2c, %edx
callq 0x1030
leaq 0x4bf0(%rip), %rdi      # 0x632d
leaq 0x4933(%rip), %rsi      # 0x6077
leaq 0x493a(%rip), %rcx      # 0x6085
movl $0x2d, %edx
callq 0x1030
leaq 0x4c08(%rip), %rdi      # 0x6364
leaq 0x4914(%rip), %rsi      # 0x6077
leaq 0x491b(%rip), %rcx      # 0x6085
movl $0x2e, %edx
callq 0x1030
leaq 0x4c20(%rip), %rdi      # 0x639b
leaq 0x48f5(%rip), %rsi      # 0x6077
leaq 0x48fc(%rip), %rcx      # 0x6085
movl $0x2f, %edx
callq 0x1030
leaq 0x4c38(%rip), %rdi      # 0x63d2
leaq 0x48d6(%rip), %rsi      # 0x6077
leaq 0x48dd(%rip), %rcx      # 0x6085
movl $0x32, %edx
callq 0x1030
leaq 0x4c50(%rip), %rdi      # 0x6409
leaq 0x48b7(%rip), %rsi      # 0x6077
leaq 0x48be(%rip), %rcx      # 0x6085
movl $0x33, %edx
callq 0x1030
leaq 0x4c68(%rip), %rdi      # 0x6440
leaq 0x4898(%rip), %rsi      # 0x6077
leaq 0x489f(%rip), %rcx      # 0x6085
movl $0x34, %edx
callq 0x1030
leaq 0x4c80(%rip), %rdi      # 0x6477
leaq 0x4879(%rip), %rsi      # 0x6077
leaq 0x4880(%rip), %rcx      # 0x6085
movl $0x35, %edx
callq 0x1030
leaq 0x4c98(%rip), %rdi      # 0x64ae
leaq 0x485a(%rip), %rsi      # 0x6077
leaq 0x4861(%rip), %rcx      # 0x6085
movl $0x38, %edx
callq 0x1030
leaq 0x4cb0(%rip), %rdi      # 0x64e5
leaq 0x483b(%rip), %rsi      # 0x6077
leaq 0x4842(%rip), %rcx      # 0x6085
movl $0x39, %edx
callq 0x1030
leaq 0x4cc8(%rip), %rdi      # 0x651c
leaq 0x481c(%rip), %rsi      # 0x6077
leaq 0x4823(%rip), %rcx      # 0x6085
movl $0x3a, %edx
callq 0x1030
leaq 0x4ce0(%rip), %rdi      # 0x6553
leaq 0x47fd(%rip), %rsi      # 0x6077
leaq 0x4804(%rip), %rcx      # 0x6085
movl $0x3b, %edx
callq 0x1030
leaq 0x4cf8(%rip), %rdi      # 0x658a
leaq 0x47de(%rip), %rsi      # 0x6077
leaq 0x47e5(%rip), %rcx      # 0x6085
movl $0x40, %edx
callq 0x1030
leaq 0x4cf1(%rip), %rdi      # 0x65a2
leaq 0x47bf(%rip), %rsi      # 0x6077
leaq 0x47c6(%rip), %rcx      # 0x6085
movl $0x41, %edx
callq 0x1030
leaq 0x4cef(%rip), %rdi      # 0x65bf
leaq 0x47a0(%rip), %rsi      # 0x6077
leaq 0x47a7(%rip), %rcx      # 0x6085
movl $0x42, %edx
callq 0x1030
leaq 0x4cee(%rip), %rdi      # 0x65dd
leaq 0x4781(%rip), %rsi      # 0x6077
leaq 0x4788(%rip), %rcx      # 0x6085
movl $0x43, %edx
callq 0x1030
leaq 0x4ced(%rip), %rdi      # 0x65fb
leaq 0x4762(%rip), %rsi      # 0x6077
leaq 0x4769(%rip), %rcx      # 0x6085
movl $0x44, %edx
callq 0x1030
leaq 0x4ced(%rip), %rdi      # 0x661a
leaq 0x4743(%rip), %rsi      # 0x6077
leaq 0x474a(%rip), %rcx      # 0x6085
movl $0x45, %edx
callq 0x1030
leaq 0x4cfd(%rip), %rdi      # 0x6649
leaq 0x4724(%rip), %rsi      # 0x6077
leaq 0x472b(%rip), %rcx      # 0x6085
movl $0x46, %edx
callq 0x1030
leaq 0x4cfd(%rip), %rdi      # 0x6668
leaq 0x4705(%rip), %rsi      # 0x6077
leaq 0x470c(%rip), %rcx      # 0x6085
movl $0x47, %edx
callq 0x1030
leaq 0x4cfd(%rip), %rdi      # 0x6687
leaq 0x46e6(%rip), %rsi      # 0x6077
leaq 0x46ed(%rip), %rcx      # 0x6085
movl $0x4a, %edx
callq 0x1030
leaq 0x4cf3(%rip), %rdi      # 0x669c
leaq 0x46c7(%rip), %rsi      # 0x6077
leaq 0x46ce(%rip), %rcx      # 0x6085
movl $0x4b, %edx
callq 0x1030
leaq 0x4ce9(%rip), %rdi      # 0x66b1
leaq 0x46a8(%rip), %rsi      # 0x6077
leaq 0x46af(%rip), %rcx      # 0x6085
movl $0x4c, %edx
callq 0x1030
leaq 0x4cdf(%rip), %rdi      # 0x66c6
leaq 0x4689(%rip), %rsi      # 0x6077
leaq 0x4690(%rip), %rcx      # 0x6085
movl $0x4d, %edx
callq 0x1030
leaq 0x4cd5(%rip), %rdi      # 0x66db
leaq 0x466a(%rip), %rsi      # 0x6077
leaq 0x4671(%rip), %rcx      # 0x6085
movl $0x4f, %edx
callq 0x1030
leaq 0x4cc3(%rip), %rdi      # 0x66e8
leaq 0x464b(%rip), %rsi      # 0x6077
leaq 0x4652(%rip), %rcx      # 0x6085
movl $0x50, %edx
callq 0x1030
leaq 0x4cb1(%rip), %rdi      # 0x66f5
leaq 0x462c(%rip), %rsi      # 0x6077
leaq 0x4633(%rip), %rcx      # 0x6085
movl $0x51, %edx
callq 0x1030
leaq 0x4dde(%rip), %rdi      # 0x6841
leaq 0x460d(%rip), %rsi      # 0x6077
leaq 0x4614(%rip), %rcx      # 0x6085
movl $0x52, %edx
callq 0x1030