#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*/ printf(char *, ...);
void main(int argc) {
  int x = 0;
  int a, b, c;
  printf("Figure 19.2\n");
  x = 1;
  b = argc;
  a = 0;
  printf("1");
  x = 2;
  if (b < 4) {
    x = 3;
    a = b;
  }
  x = 4;
  c = a + b;
  printf("C is %d\n", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x8(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1170 <main+0x60>
movl   $0x3,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
lea    0xecf(%rip),%rdi
call   1040 <puts@plt>
mov    $0x31,%edi
call   1030 <putchar@plt>
cmp    $0x4,%ebx
mov    $0x0,%esi
cmovl  %ebx,%esi
add    %ebx,%esi
lea    0xea3(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Figure 19.2\0A\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [9 x i8] c"C is %d\0A\00"
define void @main(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
%8 = load i32, i32* %2
store i32 %8, i32* %5
store i32 0, i32* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %3
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %14
12: ; preds = %1
store i32 3, i32* %3
%13 = load i32, i32* %5
store i32 %13, i32* %4
br label %14
14: ; preds = %12, %1
store i32 4, i32* %3
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = add nsw i32 %15, %16
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %18)
ret void
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c"C is %d\0A\00"
@str = [12 x i8] c"Figure 19.2\00"
define void @main(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 49)
%4 = icmp slt i32 %0, 4
%5 = select i1 %4, i32 %0, i32 0
%6 = add nsw i32 %5, %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret void
}