#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 *, long long *);
long long int acceptInteger() {
  long long int num = 0;
  while (num < 1) {
    printf("\nEnter your number: ");
    scanf("%lld", &num);
    if (num < 1)
      printf("\nError! Positive values only!!\n");
  }
  return num;
}


x86 assembly (clang, -O0):
<acceptInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
cmpq   $0x1,-0x8(%rbp)
jge    1173 <acceptInteger+0x53>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x1,-0x8(%rbp)
jge    116e <acceptInteger+0x4e>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
jmp    1130 <acceptInteger+0x10>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acceptInteger>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
lea    0xeb9(%rip),%r14
lea    0xec7(%rip),%r15
mov    %rsp,%rbx
lea    0xec2(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rax
test   %rax,%rax
jg     118d <acceptInteger+0x5d>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    (%rsp),%rax
test   %rax,%rax
jle    1160 <acceptInteger+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0AEnter your number: \00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [32 x i8] c"\0AError! Positive values only!!\0A\00"
define i64 @acceptInteger() {
%1 = alloca i64
store i64 0, i64* %1
br label %2
2: ; preds = %12, %0
%3 = load i64, i64* %1
%4 = icmp slt i64 %3, 1
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%8 = load i64, i64* %1
%9 = icmp slt i64 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %5
br label %2
13: ; preds = %2
%14 = load i64, i64* %1
ret i64 %14
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0AEnter your number: \00"
@.str.1 = [5 x i8] c"%lld\00"
@str = [31 x i8] c"\0AError! Positive values only!!\00"
define i64 @acceptInteger() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 0, i64* %1
br label %3
3: ; preds = %0, %8
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%6 = load i64, i64* %1
%7 = icmp slt i64 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%10 = load i64, i64* %1
%11 = icmp slt i64 %10, 1
br i1 %11, label %3, label %12
12: ; preds = %3, %8
%13 = phi i64 [ %10, %8 ], [ %6, %3 ]
ret i64 %13
}