#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 doubler(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i = 4;
  int j = doubler(i);
  printf("The whole is greater than the sum of parts: ");
  printf("%d + %d = %d\n", i, i, j);
  if (j == i * 2)
    printf(" - apparently not!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <doubler@plt>
mov    %eax,-0xc(%rbp)
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jne    1185 <main+0x65>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1050 <doubler@plt>
mov    %eax,%ebx
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x8,%ebx
jne    1176 <main+0x46>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"The whole is greater than the sum of parts: \00"
@.str.1 = [14 x i8] c"%d + %d = %d\0A\00"
@.str.2 = [20 x i8] c" - apparently not!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @doubler(i32 %4)
store i32 %5, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = mul nsw i32 %12, 2
%14 = icmp eq i32 %11, %13
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [45 x i8] c"The whole is greater than the sum of parts: \00"
@.str.1 = [14 x i8] c"%d + %d = %d\0A\00"
@str = [19 x i8] c" - apparently not!\00"
define i32 @main() {
%1 = tail call i32 @doubler(i32 4)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 4, i32 %1)
%4 = icmp eq i32 %1, 8
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
ret i32 0
}