#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*/ free_mem();
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ generate();
int /*<<< orphan*/ panic(char *);
int /*<<< orphan*/ read_dictionary();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  if (argc != 3) {
    panic("Incorrect number of arguments!");
  }
  if (!freopen(argv[1], "r", stdin)) {
    panic("Dictionary file does not exist!");
  }
  read_dictionary();
  freopen(argv[2], "w", stdout);
  generate();
  free_mem();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     117c <main+0x2c>
lea    0xe89(%rip),%rdi
call   1040 <panic@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e5d(%rip),%rax
mov    (%rax),%edx
lea    0xe8b(%rip),%rsi
call   1050 <freopen@plt>
cmp    $0x0,%eax
jne    11ae <main+0x5e>
lea    0xe78(%rip),%rdi
call   1040 <panic@plt>
mov    $0x0,%al
call   1030 <read_dictionary@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2e14(%rip),%rax
mov    (%rax),%edx
lea    0xe74(%rip),%rsi
call   1050 <freopen@plt>
mov    $0x0,%al
call   1070 <generate@plt>
mov    $0x0,%al
call   1060 <free_mem@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1165 <main+0x15>
lea    0xea0(%rip),%rdi
call   1040 <panic@plt>
mov    0x8(%rbx),%rdi
mov    0x2e78(%rip),%rax
mov    (%rax),%edx
lea    0xea6(%rip),%rsi
call   1050 <freopen@plt>
test   %eax,%eax
jne    118e <main+0x3e>
lea    0xe98(%rip),%rdi
call   1040 <panic@plt>
xor    %eax,%eax
call   1030 <read_dictionary@plt>
mov    0x10(%rbx),%rdi
mov    0x2e38(%rip),%rax
mov    (%rax),%edx
lea    0xe98(%rip),%rsi
call   1050 <freopen@plt>
xor    %eax,%eax
call   1070 <generate@plt>
xor    %eax,%eax
call   1060 <free_mem@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Incorrect number of arguments!\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [32 x i8] c"Dictionary file does not exist!\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @panic(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = load i32, i32* @stdin
%15 = call i32 @freopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %10
%18 = call i32 @panic(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %10
%20 = call i32 (...) @read_dictionary()
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = load i32, i32* @stdout
%25 = call i32 @freopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = call i32 (...) @generate()
%27 = call i32 (...) @free_mem()
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Incorrect number of arguments!\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [32 x i8] c"Dictionary file does not exist!\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @panic(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i32, i32* @stdin
%10 = tail call i32 @freopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = tail call i32 @panic(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %6
%15 = tail call i32 (...) @read_dictionary()
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = load i32, i32* @stdout
%19 = tail call i32 @freopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = tail call i32 (...) @generate()
%21 = tail call i32 (...) @free_mem()
ret i32 0
}