#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*/ getNumberTill1000(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int userInput = 0;
  printf("This program will print from your number to 1000.");
  do {
    printf("\nPlease Enter Number that is less than 1000. : ");
    scanf("%d", &userInput);
  } while (userInput >= 1000);
  getNumberTill1000(userInput);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x3e8,-0x8(%rbp)
jge    1152 <main+0x22>
mov    -0x8(%rbp),%edi
call   1050 <getNumberTill1000@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%r14
lea    0xf07(%rip),%r15
lea    0xc(%rsp),%rbx
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edi
cmp    $0x3e7,%edi
jg     1160 <main+0x30>
call   1050 <getNumberTill1000@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [50 x i8] c"This program will print from your number to 1000.\00"
@.str.1 = [48 x i8] c"\0APlease Enter Number that is less than 1000. : \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %7, %0
%5 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp sge i32 %8, 1000
br i1 %9, label %4, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = call i32 @getNumberTill1000(i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"This program will print from your number to 1000.\00"
@.str.1 = [48 x i8] c"\0APlease Enter Number that is less than 1000. : \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 999
br i1 %8, label %4, label %9
9: ; preds = %4
%10 = call i32 @getNumberTill1000(i32 %7)
ret i32 0
}