#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ init_map();
int /*<<< orphan*/ load_info(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_map();
int /*<<< orphan*/ scan_sections(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  FILE *fp;
  init_map();
  fp = fopen("platform/map.info", "r");
  if (fp) {
    load_info(fp);
    fclose(fp);
  }
  scan_sections(stdin);
  print_map();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <init_map@plt>
lea    0xe6c(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11c1 <main+0x51>
mov    -0x18(%rbp),%rdi
call   1040 <load_info@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   1050 <scan_sections@plt>
mov    $0x0,%al
call   1070 <print_map@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <init_map@plt>
lea    0xe81(%rip),%rdi
lea    0xe8c(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11a3 <main+0x33>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <load_info@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1050 <scan_sections@plt>
xor    %eax,%eax
call   1070 <print_map@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"platform/map.info\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @init_map()
%8 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %6
%9 = load i32*, i32** %6
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32*, i32** %6
%13 = call i32 @load_info(i32* %12)
%14 = load i32*, i32** %6
%15 = call i32 @fclose(i32* %14)
br label %16
16: ; preds = %11, %2
%17 = load i32, i32* @stdin
%18 = call i32 @scan_sections(i32 %17)
%19 = call i32 (...) @print_map()
%20 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"platform/map.info\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @init_map()
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @load_info(i32* %4)
%8 = tail call i32 @fclose(i32* %4)
br label %9
9: ; preds = %6, %2
%10 = load i32, i32* @stdin
%11 = tail call i32 @scan_sections(i32 %10)
%12 = tail call i32 (...) @print_map()
%13 = tail call i32 @exit(i32 0)
unreachable
}