#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*/ *areaConfCreate();
int /*<<< orphan*/ areaConfGenerate(int /*<<< orphan*/ *, int *, int *, float,
                                    float);
int /*<<< orphan*/ calculateLetterBoxAdjustment(float *, float *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *outputConfCreate();
int /*<<< orphan*/ outputConfGenerate(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ verifySettings();
int main(void) {
  int areasX, areasY;
  FILE *areaConfFp, *outputConfFp;
  float letterBoxYPercent, letterBoxXPercent;
  if (!verifySettings())
    return 1;
  if ((areaConfFp = areaConfCreate()) == NULL)
    return 2;
  if ((outputConfFp = outputConfCreate()) == NULL)
    return 3;
  calculateLetterBoxAdjustment(&letterBoxXPercent, &letterBoxYPercent);
  areaConfGenerate(areaConfFp, &areasX, &areasY, letterBoxXPercent,
                   letterBoxYPercent);
  outputConfGenerate(outputConfFp, areasX, areasY);
  fclose(outputConfFp);
  fclose(areaConfFp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1090 <verifySettings@plt>
cmp    $0x0,%eax
jne    119b <main+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    122d <main+0xbd>
mov    $0x0,%al
call   1060 <areaConfCreate@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11bc <main+0x4c>
movl   $0x2,-0x4(%rbp)
jmp    122d <main+0xbd>
mov    $0x0,%al
call   1030 <outputConfCreate@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11dd <main+0x6d>
movl   $0x3,-0x4(%rbp)
jmp    122d <main+0xbd>
lea    -0x28(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1070 <calculateLetterBoxAdjustment@plt>
mov    -0x18(%rbp),%rdi
movss  -0x28(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <areaConfGenerate@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1080 <outputConfGenerate@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1090 <verifySettings@plt>
test   %eax,%eax
je     11f0 <main+0x80>
xor    %eax,%eax
call   1060 <areaConfCreate@plt>
test   %rax,%rax
je     11f7 <main+0x87>
mov    %rax,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <outputConfCreate@plt>
test   %rax,%rax
je     11fe <main+0x8e>
mov    %rax,%r15
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
call   1070 <calculateLetterBoxAdjustment@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
call   1040 <areaConfGenerate@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r15,%rdi
call   1080 <outputConfGenerate@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
jmp    1203 <main+0x93>
mov    $0x1,%ebx
jmp    1203 <main+0x93>
mov    $0x2,%ebx
jmp    1203 <main+0x93>
mov    $0x3,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (...) @verifySettings()
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %0
store i32 1, i32* %1
br label %33
11: ; preds = %0
%12 = call i32* (...) @areaConfCreate()
store i32* %12, i32** %4
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 2, i32* %1
br label %33
15: ; preds = %11
%16 = call i32* (...) @outputConfCreate()
store i32* %16, i32** %5
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 3, i32* %1
br label %33
19: ; preds = %15
%20 = call i32 @calculateLetterBoxAdjustment(float* %7, float* %6)
%21 = load i32*, i32** %4
%22 = load float, float* %7
%23 = load float, float* %6
%24 = call i32 @areaConfGenerate(i32* %21, i32* %2, i32* %3, float %22, float %23)
%25 = load i32*, i32** %5
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = call i32 @outputConfGenerate(i32* %25, i32 %26, i32 %27)
%29 = load i32*, i32** %5
%30 = call i32 @fclose(i32* %29)
%31 = load i32*, i32** %4
%32 = call i32 @fclose(i32* %31)
store i32 0, i32* %1
br label %33
33: ; preds = %19, %18, %14, %10
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = tail call i32 (...) @verifySettings()
%10 = icmp eq i32 %9, 0
br i1 %10, label %27, label %11
11: ; preds = %0
%12 = tail call i32* (...) @areaConfCreate()
%13 = icmp eq i32* %12, null
br i1 %13, label %27, label %14
14: ; preds = %11
%15 = tail call i32* (...) @outputConfCreate()
%16 = icmp eq i32* %15, null
br i1 %16, label %27, label %17
17: ; preds = %14
%18 = call i32 @calculateLetterBoxAdjustment(float* %4, float* %3)
%19 = load float, float* %4
%20 = load float, float* %3
%21 = call i32 @areaConfGenerate(i32* %12, i32* %1, i32* %2, float %19, float %20)
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = call i32 @outputConfGenerate(i32* %15, i32 %22, i32 %23)
%25 = call i32 @fclose(i32* %15)
%26 = call i32 @fclose(i32* %12)
br label %27
27: ; preds = %14, %11, %0, %17
%28 = phi i32 [ 0, %17 ], [ 1, %0 ], [ 2, %11 ], [ 3, %14 ]
ret i32 %28
}