#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 const *);
int /*<<< orphan*/ scanf(char *, char *);
int sscanf(char *, char *, int *);
int ui__getInteger(const char *message) {
  char s[15];
  int ret = 0;
  int r = 0;
  printf(message);
  scanf("%15s", s);
  while (sscanf(s, "%d", &ret) != 1) {
    printf(message);
    scanf("%15s", s);
  }
  return ret;
}


x86 assembly (clang, -O0):
<ui__getInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <printf@plt>
lea    -0x17(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x17(%rbp),%rdi
lea    0xe97(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     119e <ui__getInteger+0x6e>
mov    -0x8(%rbp),%rdi
call   1030 <printf@plt>
lea    -0x17(%rbp),%rsi
lea    0xe6c(%rip),%rdi
call   1050 <scanf@plt>
jmp    1163 <ui__getInteger+0x33>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui__getInteger>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%r15
movl   $0x0,0xc(%rsp)
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    0x11(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xe9d(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     11c6 <ui__getInteger+0x96>
lea    0xe7f(%rip),%r14
lea    0x11(%rsp),%rbx
lea    0xe78(%rip),%r12
lea    0xc(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    11a0 <ui__getInteger+0x70>
mov    0xc(%rsp),%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%15s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @ui__getInteger(i8* %0) {
%2 = alloca i8*
%3 = alloca [15 x i8]
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
store i32 0, i32* %5
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* %6)
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %14, %1
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i8*, i8** %2
%16 = call i32 @printf(i8* %15)
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%18 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %10
19: ; preds = %10
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
@.str = [5 x i8] c"%15s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @ui__getInteger(i8* nocapture %0) {
%2 = alloca [15 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = tail call i32 @printf(i8* dereferenceable(1) %0)
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = icmp eq i32 %8, 1
br i1 %9, label %15, label %10
10: ; preds = %1, %10
%11 = call i32 @printf(i8* dereferenceable(1) %0)
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
%13 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %10
15: ; preds = %10, %1
%16 = load i32, i32* %3
ret i32 %16
}