#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 *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int counter;
  printf("if-else Conditional Example 1\n\n");
  printf("Enter a number: ");
  scanf("%d", &counter);
  if (counter > 100)
    printf("The number is > 100.\n");
  else
    printf("The number is <= 100.\n");
  printf("\nEnter another number: ");
  scanf("%d", &counter);
  if (counter > 100)
    printf("The number is > 100.\n");
  else if (counter <= 0)
    printf("The number is <= 0.\n");
  else
    printf("The number is between 0 and 100.\n");
  return 0;
}


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    0xede(%rip),%rdi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jle    1172 <main+0x52>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
jmp    117e <main+0x5e>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jle    11b5 <main+0x95>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <main+0xc1>
cmpl   $0x0,-0x8(%rbp)
jg     11d0 <main+0xb0>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    11dc <main+0xbc>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <main+0xc1>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rbx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x65,0xc(%rsp)
lea    0xf22(%rip),%r15
lea    0xed0(%rip),%rdi
cmovge %r15,%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
lea    0xeda(%rip),%rcx
lea    0xeb2(%rip),%rdi
cmovle %rcx,%rdi
cmp    $0x65,%eax
cmovge %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"if-else Conditional Example 1\0A\0A\00"
@.str.1 = [17 x i8] c"Enter a number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"The number is > 100.\0A\00"
@.str.4 = [23 x i8] c"The number is <= 100.\0A\00"
@.str.5 = [24 x i8] c"\0AEnter another number: \00"
@.str.6 = [21 x i8] c"The number is <= 0.\0A\00"
@.str.7 = [34 x i8] c"The number is between 0 and 100.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 100
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 100
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %27
19: ; preds = %12
%20 = load i32, i32* %2
%21 = icmp sle i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %26
24: ; preds = %19
%25 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
br label %27
27: ; preds = %26, %17
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"Enter a number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.5 = [24 x i8] c"\0AEnter another number: \00"
@str = [31 x i8] c"if-else Conditional Example 1\0A\00"
@str.8 = [22 x i8] c"The number is <= 100.\00"
@str.9 = [33 x i8] c"The number is between 0 and 100.\00"
@str.10 = [20 x i8] c"The number is <= 0.\00"
@str.12 = [21 x i8] c"The number is > 100.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 100
%8 = select i1 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @str.8, i64 0, i64 0)
%9 = call i32 @puts(i8* dereferenceable(1) %8)
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 100
%14 = icmp slt i32 %12, 1
%15 = select i1 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.10, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.9, i64 0, i64 0)
%16 = select i1 %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.12, i64 0, i64 0), i8* %15
%17 = call i32 @puts(i8* dereferenceable(1) %16)
ret i32 0
}