#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 2\n\n");
  printf("Enter a number: ");
  scanf("%d", &counter);
  if (counter > 0 && counter < 100)
    printf("The number is between 1 and 100.\n");
  else
    printf("The number is not between 1 and 100.\n");
  printf("Enter a number: ");
  scanf("%d", &counter);
  if (counter < 1 || counter > 100)
    printf("The number is not between 1 and 100.\n");
  else
    printf("The number is between 1 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   $0x0,-0x8(%rbp)
jle    117c <main+0x5c>
cmpl   $0x64,-0x8(%rbp)
jge    117c <main+0x5c>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    1188 <main+0x68>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     11b8 <main+0x98>
cmpl   $0x64,-0x8(%rbp)
jle    11c9 <main+0xa9>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    11d5 <main+0xb5>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%r12
lea    0xc(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x63,%eax
lea    0xed8(%rip),%rbx
lea    0xeac(%rip),%r13
mov    %r13,%rdi
cmovb  %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffff9b,%eax
cmp    $0xffffff9c,%eax
cmovb  %r13,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"if-else Conditional Example 2\0A\0A\00"
@.str.1 = [17 x i8] c"Enter a number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [34 x i8] c"The number is between 1 and 100.\0A\00"
@.str.4 = [38 x i8] c"The number is not between 1 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, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 100
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %15
13: ; preds = %8, %0
%14 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 1
br i1 %19, label %23, label %20
20: ; preds = %15
%21 = load i32, i32* %2
%22 = icmp sgt i32 %21, 100
br i1 %22, label %23, label %25
23: ; preds = %20, %15
%24 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
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 = [31 x i8] c"if-else Conditional Example 2\0A\00"
@str.7 = [37 x i8] c"The number is not between 1 and 100.\00"
@str.8 = [33 x i8] c"The number is between 1 and 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 = add i32 %6, -1
%8 = icmp ult i32 %7, 99
%9 = select i1 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0)
%10 = call i32 @puts(i8* dereferenceable(1) %9)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = add i32 %13, -101
%15 = icmp ult i32 %14, -100
%16 = select i1 %15, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0)
%17 = call i32 @puts(i8* dereferenceable(1) %16)
ret i32 0
}