#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*/ assert(int);
int /*<<< orphan*/ foo(int *);
int *malloc(int);
int main() {
  int a;
  int *q = malloc(sizeof(int));
  *q = 0;
  a = 0;
  foo(&a);
  foo(q);
  assert(a < 2);
  assert(*q < 2);
  assert(a > 1);
  assert(*q > 1);
  assert(a > 0);
  assert(*q > 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <foo@plt>
mov    -0x10(%rbp),%rdi
call   1050 <foo@plt>
cmpl   $0x2,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x2,(%rax)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
movl   $0x0,(%rax)
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1050 <foo@plt>
mov    %rbx,%rdi
call   1050 <foo@plt>
xor    %edi,%edi
cmpl   $0x2,0xc(%rsp)
setl   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,(%rbx)
setl   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,0xc(%rsp)
setge  %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,(%rbx)
setge  %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,0xc(%rsp)
setg   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,(%rbx)
setg   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @malloc(i32 4)
store i32* %4, i32** %3
%5 = load i32*, i32** %3
store i32 0, i32* %5
store i32 0, i32* %2
%6 = call i32 @foo(i32* %2)
%7 = load i32*, i32** %3
%8 = call i32 @foo(i32* %7)
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 2
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32*, i32** %3
%14 = load i32, i32* %13
%15 = icmp slt i32 %14, 2
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 1
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32*, i32** %3
%23 = load i32, i32* %22
%24 = icmp sgt i32 %23, 1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* %2
%28 = icmp sgt i32 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load i32*, i32** %3
%32 = load i32, i32* %31
%33 = icmp sgt i32 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32* @malloc(i32 4)
store i32 0, i32* %3
store i32 0, i32* %1
%4 = call i32 @foo(i32* %1)
%5 = call i32 @foo(i32* %3)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 2
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 2
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 1
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 1
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* %1
%23 = icmp sgt i32 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i32, i32* %3
%27 = icmp sgt i32 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
ret i32 0
}