#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 GetInteger();
int /*<<< orphan*/ printf(char *);
main() {
  int n;
  printf("Program to classify a number by its sign.\n");
  printf("n = ? ");
  n = GetInteger();
  if (n > 0) {
    printf("That number is positive.\n");
  } else if (n == 0) {
    printf("That number is zero.\n");
  } else {
    printf("That number is negative.\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <GetInteger@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    116c <main+0x4c>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
jmp    1198 <main+0x78>
cmpl   $0x0,-0x8(%rbp)
jne    1187 <main+0x67>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
jmp    1193 <main+0x73>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    1198 <main+0x78>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <GetInteger@plt>
test   %eax,%eax
lea    0xef1(%rip),%rax
lea    0xed1(%rip),%rcx
cmove  %rax,%rcx
lea    0xef4(%rip),%rdi
cmovle %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Program to classify a number by its sign.\0A\00"
@.str.1 = [7 x i8] c"n = ? \00"
@.str.2 = [26 x i8] c"That number is positive.\0A\00"
@.str.3 = [22 x i8] c"That number is zero.\0A\00"
@.str.4 = [26 x i8] c"That number is negative.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @GetInteger()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %18
10: ; preds = %0
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %17
15: ; preds = %10
%16 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
br label %18
18: ; preds = %17, %8
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"n = ? \00"
@str = [42 x i8] c"Program to classify a number by its sign.\00"
@str.5 = [25 x i8] c"That number is negative.\00"
@str.6 = [21 x i8] c"That number is zero.\00"
@str.7 = [25 x i8] c"That number is positive.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @GetInteger()
%4 = icmp sgt i32 %3, 0
%5 = icmp eq i32 %3, 0
%6 = select i1 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.5, i64 0, i64 0)
%7 = select i1 %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0), i8* %6
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}