#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ quit();
scalar_t__ strcmp(char *, char *);
void readint(FILE *file, char *keyword, int *ptr) {
  char buf[101];
  int value;
  int returnval;
  returnval = fscanf(file, "%100s", buf);
  if (returnval != 1)
    quit();
  if (strcmp(keyword, buf) != 0)
    quit();
  returnval = fscanf(file, "%10s", buf);
  if (returnval != 1)
    quit();
  if (strcmp("=", buf) != 0)
    quit();
  returnval = fscanf(file, "%d", ptr);
  if (returnval != 1)
    quit();
}


x86 assembly (clang, -O0):
<readint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    %eax,-0x88(%rbp)
cmpl   $0x1,-0x88(%rbp)
je     1177 <readint+0x47>
mov    $0x0,%al
call   1030 <quit@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1195 <readint+0x65>
mov    $0x0,%al
call   1030 <quit@plt>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    %eax,-0x88(%rbp)
cmpl   $0x1,-0x88(%rbp)
je     11c5 <readint+0x95>
mov    $0x0,%al
call   1030 <quit@plt>
lea    -0x80(%rbp),%rsi
lea    0xe3b(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11e6 <readint+0xb6>
mov    $0x0,%al
call   1030 <quit@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe18(%rip),%rsi
mov    $0x0,%al
call   1040 <fscanf@plt>
mov    %eax,-0x88(%rbp)
cmpl   $0x1,-0x88(%rbp)
je     1216 <readint+0xe6>
mov    $0x0,%al
call   1030 <quit@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readint>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xeb7(%rip),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
cmp    $0x1,%eax
je     115f <readint+0x2f>
xor    %eax,%eax
call   1030 <quit@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1176 <readint+0x46>
xor    %eax,%eax
call   1030 <quit@plt>
lea    0xe89(%rip),%rsi
mov    %rsp,%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <fscanf@plt>
cmp    $0x1,%eax
je     1196 <readint+0x66>
xor    %eax,%eax
call   1030 <quit@plt>
lea    0xe6e(%rip),%rdi
mov    %rsp,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11b1 <readint+0x81>
xor    %eax,%eax
call   1030 <quit@plt>
lea    0xe55(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
cmp    $0x1,%eax
je     11d1 <readint+0xa1>
xor    %eax,%eax
call   1030 <quit@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%100s\00"
@.str.1 = [5 x i8] c"%10s\00"
@.str.2 = [2 x i8] c"=\00"
@.str.3 = [3 x i8] c"%d\00"
define void @readint(i32* %0, i8* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [101 x i8]
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%10 = load i32*, i32** %4
%11 = getelementptr inbounds [101 x i8], [101 x i8]* %7, i64 0, i64 0
%12 = call i32 (i32*, i8*, ...) @fscanf(i32* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 %12, i32* %9
%13 = load i32, i32* %9
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = call i32 (...) @quit()
br label %17
17: ; preds = %15, %3
%18 = load i8*, i8** %5
%19 = getelementptr inbounds [101 x i8], [101 x i8]* %7, i64 0, i64 0
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 (...) @quit()
br label %24
24: ; preds = %22, %17
%25 = load i32*, i32** %4
%26 = getelementptr inbounds [101 x i8], [101 x i8]* %7, i64 0, i64 0
%27 = call i32 (i32*, i8*, ...) @fscanf(i32* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %26)
store i32 %27, i32* %9
%28 = load i32, i32* %9
%29 = icmp ne i32 %28, 1
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 (...) @quit()
br label %32
32: ; preds = %30, %24
%33 = getelementptr inbounds [101 x i8], [101 x i8]* %7, i64 0, i64 0
%34 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 (...) @quit()
br label %38
38: ; preds = %36, %32
%39 = load i32*, i32** %4
%40 = load i32*, i32** %6
%41 = call i32 (i32*, i8*, ...) @fscanf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %40)
store i32 %41, i32* %9
%42 = load i32, i32* %9
%43 = icmp ne i32 %42, 1
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = call i32 (...) @quit()
br label %46
46: ; preds = %44, %38
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%100s\00"
@.str.1 = [5 x i8] c"%10s\00"
@.str.2 = [2 x i8] c"=\00"
@.str.3 = [3 x i8] c"%d\00"
define void @readint(i32* nocapture %0, i8* %1, i32* %2) {
%4 = alloca [101 x i8]
%5 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%6 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = icmp eq i32 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = call i32 (...) @quit()
br label %10
10: ; preds = %8, %3
%11 = call i64 @strcmp(i8* %1, i8* %5)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 (...) @quit()
br label %15
15: ; preds = %13, %10
%16 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%17 = icmp eq i32 %16, 1
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 (...) @quit()
br label %20
20: ; preds = %18, %15
%21 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 (...) @quit()
br label %25
25: ; preds = %23, %20
%26 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%27 = icmp eq i32 %26, 1
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = call i32 (...) @quit()
br label %30
30: ; preds = %28, %25
ret void
}