#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stdin;
void AskInt(char *question, int *answer) {
  char reply[256];
  printf("%s <%d> ==> ", question, *answer);
  fgets(reply, 256, stdin);
  if (reply[0])
    sscanf(reply, "%d", answer);
}


x86 assembly (clang, -O0):
<AskInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmpb   $0x0,-0x110(%rbp)
je     1197 <AskInt+0x67>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe7b(%rip),%rsi
call   1050 <sscanf@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AskInt>:
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    (%rbx),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
cmpb   $0x0,(%rsp)
je     117a <AskInt+0x4a>
lea    0xe9e(%rip),%rsi
mov    %rsp,%rdi
mov    %rbx,%rdx
call   1050 <sscanf@plt>
add    $0x100,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%s <%d> ==> \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
define void @AskInt(i8* %0, i32* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %5)
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %4, i32 256, i32 %7)
%9 = load i8, i8* %4
%10 = icmp eq i8 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %13
13: ; preds = %11, %2
ret void
}