#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 fun1(unsigned int a) {
  if (a)
    printf("A is zero!");
  if (a <= 0)
    printf("Zero branch\n");
  else if (a > 1)
    printf("Anything other branch\n");
  else
    printf("One branch\n");
}


x86 assembly (clang, -O0):
<fun1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1131 <fun1+0x21>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
ja     114c <fun1+0x3c>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    1178 <fun1+0x68>
cmpl   $0x1,-0x4(%rbp)
jbe    1167 <fun1+0x57>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
jmp    1173 <fun1+0x63>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
jmp    1178 <fun1+0x68>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun1>:
test   %edi,%edi
je     114e <fun1+0x2e>
push   %rbx
mov    %edi,%ebx
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
cmp    $0x1,%ebx
lea    0xece(%rip),%rax
lea    0xed2(%rip),%rdi
cmove  %rax,%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xed7(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"A is zero!\00"
@.str.1 = [13 x i8] c"Zero branch\0A\00"
@.str.2 = [23 x i8] c"Anything other branch\0A\00"
@.str.3 = [12 x i8] c"One branch\0A\00"
define void @fun1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* %2
%9 = icmp ule i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %20
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp ugt i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %19
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
br label %20
20: ; preds = %19, %10
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"A is zero!\00"
@str = [11 x i8] c"One branch\00"
@str.4 = [22 x i8] c"Anything other branch\00"
@str.5 = [12 x i8] c"Zero branch\00"
define void @fun1(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %0, 1
%6 = select i1 %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0), %1 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
ret void
}