#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ process(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  if (argc != 3) {
    puts("Usage : md2odt <input> <output>");
    return 1;
  }
  FILE *input = fopen(argv[1], "r");
  if (!input) {
    puts("Unable to open input file");
    return 2;
  }
  FILE *output = fopen(argv[2], "w");
  if (!output) {
    puts("Unable to create output file");
    fclose(input);
    return 3;
  }
  process(input, output);
  fclose(output);
  fclose(input);
  puts("Done processing");
  return 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)
cmpl   $0x3,-0x8(%rbp)
je     1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1229 <main+0xe9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe99(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b3 <main+0x73>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
movl   $0x2,-0x4(%rbp)
jmp    1229 <main+0xe9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe7a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f7 <main+0xb7>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x3,-0x4(%rbp)
jmp    1229 <main+0xe9>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <process@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe3e(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    11a7 <main+0x67>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xec9(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11ba <main+0x7a>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xecd(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11cd <main+0x8d>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <process@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    11e6 <main+0xa6>
lea    0xe52(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    11e6 <main+0xa6>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%eax
jmp    11e6 <main+0xa6>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    $0x3,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Usage : md2odt <input> <output>\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c"Unable to open input file\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [29 x i8] c"Unable to create output file\00"
@.str.5 = [16 x i8] c"Done processing\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %41
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp ne i32* %17, null
br i1 %18, label %21, label %19
19: ; preds = %12
%20 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 2, i32* %3
br label %41
21: ; preds = %12
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %25, i32** %7
%26 = load i32*, i32** %7
%27 = icmp ne i32* %26, null
br i1 %27, label %32, label %28
28: ; preds = %21
%29 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32*, i32** %6
%31 = call i32 @fclose(i32* %30)
store i32 3, i32* %3
br label %41
32: ; preds = %21
%33 = load i32*, i32** %6
%34 = load i32*, i32** %7
%35 = call i32 @process(i32* %33, i32* %34)
%36 = load i32*, i32** %7
%37 = call i32 @fclose(i32* %36)
%38 = load i32*, i32** %6
%39 = call i32 @fclose(i32* %38)
%40 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %41
41: ; preds = %32, %28, %19, %10
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [32 x i8] c"Usage : md2odt <input> <output>\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [26 x i8] c"Unable to open input file\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [29 x i8] c"Unable to create output file\00"
@.str.5 = [16 x i8] c"Done processing\00"
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 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %26
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %26
13: ; preds = %6
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%20 = tail call i32 @fclose(i32* %9)
br label %26
21: ; preds = %13
%22 = tail call i32 @process(i32* %9, i32* %16)
%23 = tail call i32 @fclose(i32* %16)
%24 = tail call i32 @fclose(i32* %9)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %11, %21, %18, %4
%27 = phi i32 [ 1, %4 ], [ 2, %11 ], [ 0, %21 ], [ 3, %18 ]
ret i32 %27
}