#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 *, char *);
int main(void) {
  int a = 0;
  printf("a is %s\n", a == 0 ? "zero" : a > 0 ? "positive" : "negative");
  int b = 1;
  printf("b is %s\n", b == 0 ? "zero" : b > 0 ? "positive" : "negative");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1140 <main+0x30>
lea    0xed2(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    115c <main+0x4c>
mov    -0x8(%rbp),%edx
lea    0xecd(%rip),%rax
lea    0xebd(%rip),%rcx
cmp    $0x0,%edx
cmovg  %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    118d <main+0x7d>
lea    0xe85(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11a9 <main+0x99>
mov    -0xc(%rbp),%edx
lea    0xe80(%rip),%rax
lea    0xe70(%rip),%rcx
cmp    $0x0,%edx
cmovg  %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xeea(%rip),%rsi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"a is %s\0A\00"
@.str.1 = [5 x i8] c"zero\00"
@.str.2 = [9 x i8] c"positive\00"
@.str.3 = [9 x i8] c"negative\00"
@.str.4 = [9 x i8] c"b is %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
br label %12
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
br label %12
12: ; preds = %7, %6
%13 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %6 ], [ %11, %7 ]
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 1, i32* %3
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
br label %23
18: ; preds = %12
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
br label %23
23: ; preds = %18, %17
%24 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %17 ], [ %22, %18 ]
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"a is %s\0A\00"
@.str.1 = [5 x i8] c"zero\00"
@.str.2 = [9 x i8] c"positive\00"
@.str.4 = [9 x i8] c"b is %s\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}