#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ swap_direct(scalar_t__ *, scalar_t__ *);
int /*<<< orphan*/ swap_xor(scalar_t__ *, scalar_t__ *);
int swap_correct(uint32_t x, uint32_t y) {
  uint32_t x1 = x, x2 = x, y1 = y, y2 = y;
  swap_xor(&x1, &y1);
  swap_direct(&x2, &y2);
  return (x1 == x2 && y1 == y2);
}


x86 assembly (clang, -O0):
<swap_correct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <swap_xor@plt>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <swap_direct@plt>
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x20(%rbp),%rcx
mov    %al,-0x31(%rbp)
jne    118b <swap_correct+0x6b>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_correct>:
sub    $0x28,%rsp
mov    %rdi,0x20(%rsp)
mov    %rdi,0x18(%rsp)
mov    %rsi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1040 <swap_xor@plt>
lea    0x18(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <swap_direct@plt>
mov    0x20(%rsp),%rcx
xor    0x18(%rsp),%rcx
mov    0x10(%rsp),%rdx
xor    0x8(%rsp),%rdx
xor    %eax,%eax
or     %rcx,%rdx
sete   %al
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @swap_correct(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%9 = load i64, i64* %3
store i64 %9, i64* %5
%10 = load i64, i64* %3
store i64 %10, i64* %6
%11 = load i64, i64* %4
store i64 %11, i64* %7
%12 = load i64, i64* %4
store i64 %12, i64* %8
%13 = call i32 @swap_xor(i64* %5, i64* %7)
%14 = call i32 @swap_direct(i64* %6, i64* %8)
%15 = load i64, i64* %5
%16 = load i64, i64* %6
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i64, i64* %7
%20 = load i64, i64* %8
%21 = icmp eq i64 %19, %20
br label %22
22: ; preds = %18, %2
%23 = phi i1 [ false, %2 ], [ %21, %18 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @swap_correct(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = bitcast i64* %3 to i8*
store i64 %0, i64* %3
%8 = bitcast i64* %4 to i8*
store i64 %0, i64* %4
%9 = bitcast i64* %5 to i8*
store i64 %1, i64* %5
%10 = bitcast i64* %6 to i8*
store i64 %1, i64* %6
%11 = call i32 @swap_xor(i64* %3, i64* %5)
%12 = call i32 @swap_direct(i64* %4, i64* %6)
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = icmp eq i64 %13, %14
%16 = load i64, i64* %5
%17 = load i64, i64* %6
%18 = icmp eq i64 %16, %17
%19 = select i1 %15, i1 %18, i1 false
%20 = zext i1 %19 to i32
ret i32 %20
}