#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 */

/* Variables and functions */
int /*<<< orphan*/ swap(int *, int *);
int /*<<< orphan*/ swap_bits(int *, int *);
int test_positive_zero() {
  int a = 10;
  int b = 0;
  swap(&a, &b);
  int c = 30;
  int d = 0;
  swap_bits(&c, &d);
  return a == 0 && b == 10 && c == 0 && d == 30;
}


x86 assembly (clang, -O0):
<test_positive_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <swap@plt>
movl   $0x1e,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <swap_bits@plt>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x11(%rbp)
jne    1195 <test_positive_zero+0x75>
xor    %eax,%eax
cmpl   $0xa,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jne    1195 <test_positive_zero+0x75>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jne    1195 <test_positive_zero+0x75>
cmpl   $0x1e,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_positive_zero>:
sub    $0x18,%rsp
movl   $0xa,0x14(%rsp)
movl   $0x0,0x10(%rsp)
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1040 <swap@plt>
movl   $0x1e,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <swap_bits@plt>
mov    0x10(%rsp),%ecx
xor    $0xa,%ecx
or     0x14(%rsp),%ecx
or     0xc(%rsp),%ecx
mov    0x8(%rsp),%edx
xor    $0x1e,%edx
xor    %eax,%eax
or     %ecx,%edx
sete   %al
add    $0x18,%rsp
ret

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

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