#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 */
scalar_t__ sbrk(int);
int main() {
  int rval = 1;
  rval = rval && (sbrk(0) == sbrk(0));
  rval = rval && (sbrk(5) != sbrk(0));
  rval = rval && (sbrk(0) == sbrk(5));
  return !rval;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1157 <main+0x47>
xor    %edi,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1030 <sbrk@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x19(%rbp)
je     1196 <main+0x86>
mov    $0x5,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x28(%rbp)
xor    %edi,%edi
call   1030 <sbrk@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x29(%rbp)
je     11d5 <main+0xc5>
xor    %edi,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x38(%rbp)
mov    $0x5,%edi
call   1030 <sbrk@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <sbrk@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1030 <sbrk@plt>
mov    $0x1,%ebp
cmp    %rax,%rbx
jne    1164 <main+0x54>
mov    $0x5,%edi
call   1030 <sbrk@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1030 <sbrk@plt>
cmp    %rax,%rbx
je     1164 <main+0x54>
xor    %edi,%edi
call   1030 <sbrk@plt>
mov    %rax,%rbx
mov    $0x5,%edi
call   1030 <sbrk@plt>
xor    %ebp,%ebp
cmp    %rax,%rbx
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i64 @sbrk(i32 0)
%7 = call i64 @sbrk(i32 0)
%8 = icmp eq i64 %6, %7
br label %9
9: ; preds = %5, %0
%10 = phi i1 [ false, %0 ], [ %8, %5 ]
%11 = zext i1 %10 to i32
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = call i64 @sbrk(i32 5)
%16 = call i64 @sbrk(i32 0)
%17 = icmp ne i64 %15, %16
br label %18
18: ; preds = %14, %9
%19 = phi i1 [ false, %9 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = call i64 @sbrk(i32 0)
%25 = call i64 @sbrk(i32 5)
%26 = icmp eq i64 %24, %25
br label %27
27: ; preds = %23, %18
%28 = phi i1 [ false, %18 ], [ %26, %23 ]
%29 = zext i1 %28 to i32
store i32 %29, i32* %2
%30 = load i32, i32* %2
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = zext i1 %32 to i32
ret i32 %33
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @sbrk(i32 0)
%2 = tail call i64 @sbrk(i32 0)
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %13
4: ; preds = %0
%5 = tail call i64 @sbrk(i32 5)
%6 = tail call i64 @sbrk(i32 0)
%7 = icmp eq i64 %5, %6
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = tail call i64 @sbrk(i32 0)
%10 = tail call i64 @sbrk(i32 5)
%11 = icmp ne i64 %9, %10
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %0, %8, %4
%14 = phi i32 [ 1, %4 ], [ %12, %8 ], [ 1, %0 ]
ret i32 %14
}