#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 *, char *);
char *Copy_String(char *);
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*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void Read_Mappings(FILE *stream) {
  char format_buffer[100];
  char name[1000], *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 = Copy_String(format_buffer);
    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     1283 <Read_Mappings+0xf3>
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   10b0 <Copy_String@plt>
mov    %rax,-0x470(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <Read_White_Space@plt>
lea    0xe02(%rip),%rax
mov    %rax,-0x468(%rbp)
mov    -0x8(%rbp),%rdi
call   10a0 <getc@plt>
mov    %eax,-0x478(%rbp)
mov    -0x478(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1070 <ungetc@plt>
cmpl   $0x27,-0x478(%rbp)
jne    1265 <Read_Mappings+0xd5>
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    120a <Read_Mappings+0x7a>
nop
mov    %ebp,%edi
mov    %r13,%rsi
call   1090 <Add_Mapping@plt>
mov    %rbx,%rdi
lea    0xe0c(%rip),%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1060 <fscanf@plt>
mov    0x2dda(%rip),%rcx
cmp    (%rcx),%eax
je     11c3 <Read_Mappings+0x33>
cmp    $0x2,%eax
je     121b <Read_Mappings+0x8b>
lea    0xdf7(%rip),%rdi
call   1050 <Fatal_Error@plt>
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1040 <Parse_Atom@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   10b0 <Copy_String@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1080 <Read_White_Space@plt>
mov    %rbx,%rdi
call   10a0 <getc@plt>
mov    %eax,%r12d
mov    %eax,%edi
mov    %rbx,%rsi
call   1070 <ungetc@plt>
lea    0xdc8(%rip),%rdx
cmp    $0x27,%r12d
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 = [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 = %40, %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 %45
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* @Copy_String(i8* %26)
store i8* %27, i8** %6
%28 = load i32*, i32** %2
%29 = call i32 @Read_White_Space(i32* %28)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %5
%30 = load i32*, i32** %2
%31 = call i32 @getc(i32* %30)
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32*, i32** %2
%34 = call i32 @ungetc(i32 %32, i32* %33)
%35 = load i32, i32* %8
%36 = icmp eq i32 %35, 39
br i1 %36, label %37, label %40
37: ; preds = %22
%38 = load i32*, i32** %2
%39 = call i8* @Read_Quoted(i32* %38)
store i8* %39, i8** %5
br label %40
40: ; preds = %37, %22
%41 = load i32, i32* %9
%42 = load i8*, i8** %6
%43 = load i8*, i8** %5
%44 = call i32 @Add_Mapping(i32 %41, i8* %42, i8* %43)
br label %10
45: ; 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 = [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 %30, label %9
9: ; preds = %1, %24
%10 = phi i32 [ %27, %24 ], [ %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* @Copy_String(i8* %4)
%18 = call i32 @Read_White_Space(i32* %0)
%19 = call i32 @getc(i32* %0)
%20 = call i32 @ungetc(i32 %19, i32* %0)
%21 = icmp eq i32 %19, 39
br i1 %21, label %22, label %24
22: ; preds = %14
%23 = call i8* @Read_Quoted(i32* %0)
br label %24
24: ; preds = %22, %14
%25 = phi i8* [ %23, %22 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %14 ]
%26 = call i32 @Add_Mapping(i32 %16, i8* %17, i8* %25)
%27 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %4)
%28 = load i32, i32* @EOF
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %9
30: ; preds = %24, %1
ret void
}