#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*/ getLine(char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int getInteger() {
  char str[9];
  int result = 0;
  getLine(str, 9);
  sscanf(str, "%d", &result);
  if ((result < -999999 && result != -9999999) || (result > 999999))
    return -8888888;
  return result;
}


x86 assembly (clang, -O0):
<getInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
lea    -0xd(%rbp),%rdi
mov    $0x9,%esi
call   1040 <getLine@plt>
lea    -0xd(%rbp),%rdi
lea    0xeb8(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
cmpl   $0xfff0bdc1,-0x14(%rbp)
jge    116b <getInteger+0x4b>
cmpl   $0xff676981,-0x14(%rbp)
jne    1178 <getInteger+0x58>
cmpl   $0xf423f,-0x14(%rbp)
jle    1184 <getInteger+0x64>
movl   $0xff785dc8,-0x4(%rbp)
jmp    118a <getInteger+0x6a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInteger>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,(%rsp)
lea    0x7(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <getLine@plt>
lea    0xebb(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1030 <sscanf@plt>
mov    (%rsp),%ecx
cmp    $0xff676981,%ecx
mov    $0xff785dc8,%edx
mov    %ecx,%eax
cmovne %edx,%eax
cmp    $0xfff0bdc1,%ecx
cmovge %ecx,%eax
cmp    $0xf4240,%ecx
cmovge %edx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @getInteger() {
%1 = alloca [9 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @getLine(i8* %3, i32 9)
%6 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, -999999
%9 = icmp ne i32 %7, -9999999
%10 = and i1 %8, %9
%11 = icmp sgt i32 %7, 999999
%12 = or i1 %11, %10
%13 = select i1 %12, i32 -8888888, i32 %7
ret i32 %13
}