#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*/ cwd;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char const *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ pla(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ pocketPla(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int, int, double, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ randomPLA(int, int /*<<< orphan*/ *, int, double);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int pla_main(int argc, const char *argv[]) {
  int dim = atoi(argv[1]) + 1, repeat = atoi(argv[3]);
  FILE *file = fopen(argv[2], "r");
  FILE *ftrain = fopen(argv[4], "r");
  FILE *ftest = fopen(argv[5], "r");
  if (file != NULL) {
    pla(dim, file);
    rewind(file);
    randomPLA(dim, file, repeat, 1.0);
    rewind(file);
    randomPLA(dim, file, repeat, 0.5);
    pocketPla(dim, ftrain, ftest, 200, 50, 1.0, 1);
    rewind(ftrain);
    rewind(ftest);
    pocketPla(dim, ftrain, ftest, 200, 50, 1.0, 0);
    rewind(ftrain);
    rewind(ftest);
    pocketPla(dim, ftrain, ftest, 200, 100, 1.0, 1);
  } else {
    char cwd[1024];
    getcwd(cwd, sizeof(cwd));
    printf("File is not found. %s", cwd);
  }
  fclose(file);
  fclose(ftrain);
  fclose(ftest);
  return 0;
}


x86 assembly (clang, -O0):
<pla_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe3c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xe24(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xe0c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1305 <pla_main+0x175>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <pla@plt>
mov    -0x20(%rbp),%rdi
call   1070 <rewind@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
movsd  0xdc1(%rip),%xmm0
call   1090 <randomPLA@plt>
mov    -0x20(%rbp),%rdi
call   1070 <rewind@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
movsd  0xda9(%rip),%xmm0
call   1090 <randomPLA@plt>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0xc8,%ecx
mov    $0x32,%r8d
movsd  0xd7e(%rip),%xmm0
mov    $0x1,%r9d
call   1040 <pocketPla@plt>
mov    -0x28(%rbp),%rdi
call   1070 <rewind@plt>
mov    -0x30(%rbp),%rdi
call   1070 <rewind@plt>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0xc8,%ecx
mov    $0x32,%r8d
movsd  0xd43(%rip),%xmm0
xor    %r9d,%r9d
call   1040 <pocketPla@plt>
mov    -0x28(%rbp),%rdi
call   1070 <rewind@plt>
mov    -0x30(%rbp),%rdi
call   1070 <rewind@plt>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0xc8,%ecx
mov    $0x64,%r8d
movsd  0xd0b(%rip),%xmm0
mov    $0x1,%r9d
call   1040 <pocketPla@plt>
jmp    1329 <pla_main+0x199>
lea    -0x430(%rbp),%rdi
mov    $0x400,%esi
call   1080 <getcwd@plt>
lea    -0x430(%rbp),%rsi
lea    0xcee(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pla_main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r12d
mov    0x18(%rbx),%rdi
call   10b0 <atoi@plt>
mov    %eax,0xc(%rsp)
mov    0x10(%rbx),%rdi
lea    0xe48(%rip),%rbp
mov    %rbp,%rsi
call   10a0 <fopen@plt>
mov    %rax,%r13
mov    0x20(%rbx),%rdi
mov    %rbp,%rsi
call   10a0 <fopen@plt>
mov    %rax,%r14
mov    0x28(%rbx),%rdi
mov    %rbp,%rsi
call   10a0 <fopen@plt>
mov    %rax,%r15
test   %r13,%r13
je     12db <pla_main+0x14b>
add    $0x1,%r12d
mov    %r12d,%edi
mov    %r13,%rsi
call   1030 <pla@plt>
mov    %r13,%rdi
call   1070 <rewind@plt>
movsd  0xde7(%rip),%xmm0
mov    %r12d,%edi
mov    %r13,%rsi
mov    0xc(%rsp),%ebx
mov    %ebx,%edx
call   1090 <randomPLA@plt>
mov    %r13,%rdi
call   1070 <rewind@plt>
movsd  0xdce(%rip),%xmm0
mov    %r12d,%edi
mov    %r13,%rsi
mov    %ebx,%edx
call   1090 <randomPLA@plt>
mov    %r12d,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0xc8,%ecx
mov    $0x32,%r8d
movsd  0xd9d(%rip),%xmm0
mov    $0x1,%r9d
call   1040 <pocketPla@plt>
mov    %r14,%rdi
call   1070 <rewind@plt>
mov    %r15,%rdi
call   1070 <rewind@plt>
mov    %r12d,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0xc8,%ecx
mov    $0x32,%r8d
movsd  0xd66(%rip),%xmm0
xor    %r9d,%r9d
call   1040 <pocketPla@plt>
mov    %r14,%rdi
call   1070 <rewind@plt>
mov    %r15,%rdi
call   1070 <rewind@plt>
mov    %r12d,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0xc8,%ecx
mov    $0x64,%r8d
movsd  0xd32(%rip),%xmm0
mov    $0x1,%r9d
call   1040 <pocketPla@plt>
jmp    12fc <pla_main+0x16c>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1080 <getcwd@plt>
lea    0xd1e(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"File is not found. %s\00"
define i32 @pla_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca [1024 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
%16 = load i8**, i8*** %4
%17 = getelementptr inbounds i8*, i8** %16, i64 3
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
%20 = load i8**, i8*** %4
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %7
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 4
%26 = load i8*, i8** %25
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %27, i32** %8
%28 = load i8**, i8*** %4
%29 = getelementptr inbounds i8*, i8** %28, i64 5
%30 = load i8*, i8** %29
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %31, i32** %9
%32 = load i32*, i32** %7
%33 = icmp ne i32* %32, null
br i1 %33, label %34, label %70
34: ; preds = %2
%35 = load i32, i32* %5
%36 = load i32*, i32** %7
%37 = call i32 @pla(i32 %35, i32* %36)
%38 = load i32*, i32** %7
%39 = call i32 @rewind(i32* %38)
%40 = load i32, i32* %5
%41 = load i32*, i32** %7
%42 = load i32, i32* %6
%43 = call i32 @randomPLA(i32 %40, i32* %41, i32 %42, double 1.000000e+00)
%44 = load i32*, i32** %7
%45 = call i32 @rewind(i32* %44)
%46 = load i32, i32* %5
%47 = load i32*, i32** %7
%48 = load i32, i32* %6
%49 = call i32 @randomPLA(i32 %46, i32* %47, i32 %48, double 5.000000e-01)
%50 = load i32, i32* %5
%51 = load i32*, i32** %8
%52 = load i32*, i32** %9
%53 = call i32 @pocketPla(i32 %50, i32* %51, i32* %52, i32 200, i32 50, double 1.000000e+00, i32 1)
%54 = load i32*, i32** %8
%55 = call i32 @rewind(i32* %54)
%56 = load i32*, i32** %9
%57 = call i32 @rewind(i32* %56)
%58 = load i32, i32* %5
%59 = load i32*, i32** %8
%60 = load i32*, i32** %9
%61 = call i32 @pocketPla(i32 %58, i32* %59, i32* %60, i32 200, i32 50, double 1.000000e+00, i32 0)
%62 = load i32*, i32** %8
%63 = call i32 @rewind(i32* %62)
%64 = load i32*, i32** %9
%65 = call i32 @rewind(i32* %64)
%66 = load i32, i32* %5
%67 = load i32*, i32** %8
%68 = load i32*, i32** %9
%69 = call i32 @pocketPla(i32 %66, i32* %67, i32* %68, i32 200, i32 100, double 1.000000e+00, i32 1)
br label %75
70: ; preds = %2
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%72 = call i32 @getcwd(i8* %71, i32 1024)
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%74 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %73)
br label %75
75: ; preds = %70, %34
%76 = load i32*, i32** %7
%77 = call i32 @fclose(i32* %76)
%78 = load i32*, i32** %8
%79 = call i32 @fclose(i32* %78)
%80 = load i32*, i32** %9
%81 = call i32 @fclose(i32* %80)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"File is not found. %s\00"
define i32 @pla_main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = add nsw i32 %6, 1
%8 = getelementptr inbounds i8*, i8** %1, i64 3
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds i8*, i8** %1, i64 4
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = getelementptr inbounds i8*, i8** %1, i64 5
%18 = load i8*, i8** %17
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i32* %13, null
br i1 %20, label %34, label %21
21: ; preds = %2
%22 = tail call i32 @pla(i32 %7, i32* %13)
%23 = tail call i32 @rewind(i32* %13)
%24 = tail call i32 @randomPLA(i32 %7, i32* %13, i32 %10, double 1.000000e+00)
%25 = tail call i32 @rewind(i32* %13)
%26 = tail call i32 @randomPLA(i32 %7, i32* %13, i32 %10, double 5.000000e-01)
%27 = tail call i32 @pocketPla(i32 %7, i32* %16, i32* %19, i32 200, i32 50, double 1.000000e+00, i32 1)
%28 = tail call i32 @rewind(i32* %16)
%29 = tail call i32 @rewind(i32* %19)
%30 = tail call i32 @pocketPla(i32 %7, i32* %16, i32* %19, i32 200, i32 50, double 1.000000e+00, i32 0)
%31 = tail call i32 @rewind(i32* %16)
%32 = tail call i32 @rewind(i32* %19)
%33 = tail call i32 @pocketPla(i32 %7, i32* %16, i32* %19, i32 200, i32 100, double 1.000000e+00, i32 1)
br label %38
34: ; preds = %2
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%36 = call i32 @getcwd(i8* %35, i32 1024)
%37 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %35)
br label %38
38: ; preds = %34, %21
%39 = call i32 @fclose(i32* %13)
%40 = call i32 @fclose(i32* %16)
%41 = call i32 @fclose(i32* %19)
ret i32 0
}