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

/* Variables and functions */
int /*<<< orphan*/ Add_Mapping(int /*<<< orphan*/, char const *, char const *);
int EOF;
int /*<<< orphan*/ False;
int /*<<< orphan*/ Fatal_Error(char *);
int /*<<< orphan*/ Parse_Atom(char *, int /*<<< orphan*/);
char *Read_Quoted(int /*<<< orphan*/ *);
int /*<<< orphan*/ Read_White_Space(int /*<<< orphan*/ *);
int fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int getc(int /*<<< orphan*/ *);
char *strdup(char *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void Read_Mappings(FILE *stream) {
  char format_buffer[100];
  char name[1000];
  const char *dformat, *format;
  int count, c;
  Atom atom;
  while ((count = fscanf(stream, " %990s %90s ", name, format_buffer)) != EOF) {
    if (count != 2)
      Fatal_Error("Bad format file format.");
    atom = Parse_Atom(name, False);
    format = strdup(format_buffer);
    if (!format)
      Fatal_Error("Out of memory!");
    Read_White_Space(stream);
    dformat = " = $0+\n";
    c = getc(stream);
    ungetc(c, stream);
    if (c == (int)'\'')
      dformat = Read_Quoted(stream);
    Add_Mapping(atom, format, dformat);
  }
}


x86 assembly (clang, -O0):
<Read_Mappings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x460(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    0xe4b(%rip),%rsi
call   1060 <fscanf@plt>
mov    %eax,-0x474(%rbp)
mov    0x2e19(%rip),%rcx
cmp    (%rcx),%eax
je     129d <Read_Mappings+0x10d>
cmpl   $0x2,-0x474(%rbp)
je     11e8 <Read_Mappings+0x58>
lea    0xe2a(%rip),%rdi
call   1050 <Fatal_Error@plt>
lea    -0x460(%rbp),%rdi
mov    0x2df2(%rip),%rax
mov    (%rax),%esi
call   1040 <Parse_Atom@plt>
mov    %eax,-0x47c(%rbp)
lea    -0x70(%rbp),%rdi
call   10a0 <strdup@plt>
mov    %rax,-0x470(%rbp)
cmpq   $0x0,-0x470(%rbp)
jne    122d <Read_Mappings+0x9d>
lea    0xdfd(%rip),%rdi
call   1050 <Fatal_Error@plt>
mov    -0x8(%rbp),%rdi
call   1080 <Read_White_Space@plt>
lea    0xdf7(%rip),%rax
mov    %rax,-0x468(%rbp)
mov    -0x8(%rbp),%rdi
call   10b0 <getc@plt>
mov    %eax,-0x478(%rbp)
mov    -0x478(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1070 <ungetc@plt>
cmpl   $0x27,-0x478(%rbp)
jne    127f <Read_Mappings+0xef>
mov    -0x8(%rbp),%rdi
call   1030 <Read_Quoted@plt>
mov    %rax,-0x468(%rbp)
mov    -0x47c(%rbp),%edi
mov    -0x470(%rbp),%rsi
mov    -0x468(%rbp),%rdx
call   1090 <Add_Mapping@plt>
jmp    119f <Read_Mappings+0xf>
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Read_Mappings>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
mov    %rdi,%rbx
lea    0xe55(%rip),%rsi
lea    0x70(%rsp),%rdx
mov    %rsp,%rcx
call   1060 <fscanf@plt>
mov    0x2e21(%rip),%rcx
cmp    (%rcx),%eax
jne    11d5 <Read_Mappings+0x45>
add    $0x458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x70(%rsp),%r14
mov    %rsp,%r15
jmp    120b <Read_Mappings+0x7b>
nop
mov    %r12d,%edi
mov    %rbp,%rsi
call   1090 <Add_Mapping@plt>
mov    %rbx,%rdi
lea    0xe0b(%rip),%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1060 <fscanf@plt>
mov    0x2dd9(%rip),%rcx
cmp    (%rcx),%eax
je     11c3 <Read_Mappings+0x33>
cmp    $0x2,%eax
je     121c <Read_Mappings+0x8c>
lea    0xdf6(%rip),%rdi
call   1050 <Fatal_Error@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1040 <Parse_Atom@plt>
mov    %eax,%r12d
mov    %r15,%rdi
call   10a0 <strdup@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    124c <Read_Mappings+0xbc>
lea    0xdde(%rip),%rdi
call   1050 <Fatal_Error@plt>
mov    %rbx,%rdi
call   1080 <Read_White_Space@plt>
mov    %rbx,%rdi
call   10b0 <getc@plt>
mov    %eax,%r13d
mov    %eax,%edi
mov    %rbx,%rsi
call   1070 <ungetc@plt>
lea    0xdc4(%rip),%rdx
cmp    $0x27,%r13d
jne    11e0 <Read_Mappings+0x50>
mov    %rbx,%rdi
call   1030 <Read_Quoted@plt>
mov    %rax,%rdx
jmp    11e0 <Read_Mappings+0x50>

LLVM IR (-O0):
@.str = [13 x i8] c" %990s %90s \00"
@EOF = global i32 0
@.str.1 = [24 x i8] c"Bad format file format.\00"
@False = global i32 0
@.str.2 = [15 x i8] c"Out of memory!\00"
@.str.3 = [8 x i8] c" = $0+\0A\00"
define void @Read_Mappings(i32* %0) {
%2 = alloca i32*
%3 = alloca [100 x i8]
%4 = alloca [1000 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %2
br label %10
10: ; preds = %45, %1
%11 = load i32*, i32** %2
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%14 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
store i32 %14, i32* %7
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %50
17: ; preds = %10
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 2
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @Fatal_Error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%24 = load i32, i32* @False
%25 = call i32 @Parse_Atom(i8* %23, i32 %24)
store i32 %25, i32* %9
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%27 = call i8* @strdup(i8* %26)
store i8* %27, i8** %6
%28 = load i8*, i8** %6
%29 = icmp ne i8* %28, null
br i1 %29, label %32, label %30
30: ; preds = %22
%31 = call i32 @Fatal_Error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30, %22
%33 = load i32*, i32** %2
%34 = call i32 @Read_White_Space(i32* %33)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %5
%35 = load i32*, i32** %2
%36 = call i32 @getc(i32* %35)
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = load i32*, i32** %2
%39 = call i32 @ungetc(i32 %37, i32* %38)
%40 = load i32, i32* %8
%41 = icmp eq i32 %40, 39
br i1 %41, label %42, label %45
42: ; preds = %32
%43 = load i32*, i32** %2
%44 = call i8* @Read_Quoted(i32* %43)
store i8* %44, i8** %5
br label %45
45: ; preds = %42, %32
%46 = load i32, i32* %9
%47 = load i8*, i8** %6
%48 = load i8*, i8** %5
%49 = call i32 @Add_Mapping(i32 %46, i8* %47, i8* %48)
br label %10
50: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c" %990s %90s \00"
@EOF = global i32 0
@.str.1 = [24 x i8] c"Bad format file format.\00"
@False = global i32 0
@.str.2 = [15 x i8] c"Out of memory!\00"
@.str.3 = [8 x i8] c" = $0+\0A\00"
define void @Read_Mappings(i32* %0) {
%2 = alloca [100 x i8]
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %4)
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %34, label %9
9: ; preds = %1, %28
%10 = phi i32 [ %31, %28 ], [ %6, %1 ]
%11 = icmp eq i32 %10, 2
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = call i32 @Fatal_Error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* @False
%16 = call i32 @Parse_Atom(i8* %5, i32 %15)
%17 = call i8* @strdup(i8* %4)
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 @Fatal_Error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %14
%22 = call i32 @Read_White_Space(i32* %0)
%23 = call i32 @getc(i32* %0)
%24 = call i32 @ungetc(i32 %23, i32* %0)
%25 = icmp eq i32 %23, 39
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i8* @Read_Quoted(i32* %0)
br label %28
28: ; preds = %26, %21
%29 = phi i8* [ %27, %26 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %21 ]
%30 = call i32 @Add_Mapping(i32 %16, i8* %17, i8* %29)
%31 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %4)
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %9
34: ; preds = %28, %1
ret void
}