#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(void) {
  int value;
  printf("enter a number: ");
  scanf("%d", &value);
  if (value >= 0 && value <= 9) {
    printf("%d is a 1 digit number.\n", value);
  } else if (value >= 10 && value <= 99) {
    printf("%d is a 2 digit number.\n", value);
  } else if (value >= 100 && value <= 999) {
    printf("%d is a 3 digit number.\n", value);
  }
  printf("ending!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     1177 <main+0x57>
cmpl   $0x9,-0x8(%rbp)
jg     1177 <main+0x57>
mov    -0x8(%rbp),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d3 <main+0xb3>
cmpl   $0xa,-0x8(%rbp)
jl     11a1 <main+0x81>
cmpl   $0x63,-0x8(%rbp)
jg     11a1 <main+0x81>
mov    -0x8(%rbp),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <main+0xae>
cmpl   $0x64,-0x8(%rbp)
jl     11c9 <main+0xa9>
cmpl   $0x3e7,-0x8(%rbp)
jg     11c9 <main+0xa9>
mov    -0x8(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <main+0xae>
jmp    11d3 <main+0xb3>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0xa,%esi
jae    1162 <main+0x32>
lea    0xeb4(%rip),%rdi
jmp    1184 <main+0x54>
lea    -0xa(%rsi),%eax
cmp    $0x5a,%eax
jae    1173 <main+0x43>
lea    0xebc(%rip),%rdi
jmp    1184 <main+0x54>
lea    -0x64(%rsi),%eax
cmp    $0x383,%eax
ja     118b <main+0x5b>
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"%d is a 1 digit number.\0A\00"
@.str.3 = [25 x i8] c"%d is a 2 digit number.\0A\00"
@.str.4 = [25 x i8] c"%d is a 3 digit number.\0A\00"
@.str.5 = [9 x i8] c"ending!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 9
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %33
13: ; preds = %7, %0
%14 = load i32, i32* %2
%15 = icmp sge i32 %14, 10
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp sle i32 %17, 99
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %32
22: ; preds = %16, %13
%23 = load i32, i32* %2
%24 = icmp sge i32 %23, 100
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %2
%27 = icmp sle i32 %26, 999
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %2
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %25, %22
br label %32
32: ; preds = %31, %19
br label %33
33: ; preds = %32, %10
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"%d is a 1 digit number.\0A\00"
@.str.3 = [25 x i8] c"%d is a 2 digit number.\0A\00"
@.str.4 = [25 x i8] c"%d is a 3 digit number.\0A\00"
@str = [8 x i8] c"ending!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp ult i32 %5, 10
br i1 %6, label %13, label %7
7: ; preds = %0
%8 = add i32 %5, -10
%9 = icmp ult i32 %8, 90
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = add i32 %5, -100
%12 = icmp ult i32 %11, 900
br i1 %12, label %13, label %16
13: ; preds = %10, %7, %0
%14 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), %0 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), %7 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), %10 ]
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %14, i32 %5)
br label %16
16: ; preds = %13, %10
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}