#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*/ EXIT_FAILURE;
float atof(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int freeQueries(void *);
int initQueries(void **, float);
int loadQueries(char *, void *);
int /*<<< orphan*/ printf(char *);
char *processError(int);
int saveQueries(char *, void *);
int /*<<< orphan*/ stderr;
int transformQueries(void *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Usage: gcandidates distance regionsfile.prof		     "
           "\n example: bin/gcandidates 0.2 input/regions-score.1M.prof \n");
    exit(0);
  }
  void *queries;
  float distance = atof(argv[1]);
  char *qryFile = argv[2];
  int error;
  error = initQueries(&queries, distance);
  {{if (error){fprintf(stderr, "%s\n", processError(error));
  exit(EXIT_FAILURE);
}
}
}
;
error = loadQueries(qryFile, queries);
{{if (error){fprintf(stderr, "%s\n", processError(error));
exit(EXIT_FAILURE);
}
}
}
;
error = transformQueries(queries);
{{if (error){fprintf(stderr, "%s\n", processError(error));
exit(EXIT_FAILURE);
}
}
}
;
error = saveQueries(qryFile, queries);
{{if (error){fprintf(stderr, "%s\n", processError(error));
exit(EXIT_FAILURE);
}
}
}
;
error = freeQueries(queries);
{{if (error){fprintf(stderr, "%s\n", processError(error));
exit(EXIT_FAILURE);
}
}
}
;
return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11d3 <main+0x33>
lea    0xe39(%rip),%rdi
call   1060 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
lea    -0x18(%rbp),%rdi
call   1080 <initQueries@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1240 <main+0xa0>
mov    0x2dcd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%edi
call   1090 <processError@plt>
mov    -0x30(%rbp),%edi
mov    %rax,%rdx
lea    0xe43(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <loadQueries@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     128e <main+0xee>
mov    0x2d7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%edi
call   1090 <processError@plt>
mov    -0x34(%rbp),%edi
mov    %rax,%rdx
lea    0xdf5(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1040 <transformQueries@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     12d8 <main+0x138>
mov    0x2d35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
call   1090 <processError@plt>
mov    -0x38(%rbp),%edi
mov    %rax,%rdx
lea    0xdab(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10b0 <saveQueries@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1326 <main+0x186>
mov    0x2ce7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%edi
call   1090 <processError@plt>
mov    -0x3c(%rbp),%edi
mov    %rax,%rdx
lea    0xd5d(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2cb9(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <freeQueries@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     1370 <main+0x1d0>
mov    0x2c9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x2c(%rbp),%edi
call   1090 <processError@plt>
mov    -0x40(%rbp),%edi
mov    %rax,%rdx
lea    0xd13(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
jle    1241 <main+0xa1>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atof@plt>
mov    0x10(%rbx),%rbx
lea    0x8(%rsp),%rdi
call   1080 <initQueries@plt>
test   %eax,%eax
jne    1212 <main+0x72>
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <loadQueries@plt>
test   %eax,%eax
jne    1212 <main+0x72>
mov    0x8(%rsp),%rdi
call   1050 <transformQueries@plt>
test   %eax,%eax
jne    1212 <main+0x72>
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10b0 <saveQueries@plt>
test   %eax,%eax
jne    1212 <main+0x72>
mov    0x8(%rsp),%rdi
call   10c0 <freeQueries@plt>
test   %eax,%eax
jne    1212 <main+0x72>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2dc7(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1090 <processError@plt>
lea    0xdd7(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1070 <fprintf@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    0xdbc(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [112 x i8] c"Usage: gcandidates distance regionsfile.prof\09\09 \0A example: bin/gcandidates 0.2 input/regions-score.1M.prof \0A\00"
@stderr = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca float
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call float @atof(i8* %18)
store float %19, float* %7
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
store i8* %22, i8** %8
%23 = load float, float* %7
%24 = call i32 @initQueries(i8** %6, float %23)
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %15
%28 = load i32, i32* @stderr
%29 = load i32, i32* %9
%30 = call i8* @processError(i32 %29)
%31 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %15
%35 = load i8*, i8** %8
%36 = load i8*, i8** %6
%37 = call i32 @loadQueries(i8* %35, i8* %36)
store i32 %37, i32* %9
%38 = load i32, i32* %9
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %34
%41 = load i32, i32* @stderr
%42 = load i32, i32* %9
%43 = call i8* @processError(i32 %42)
%44 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %43)
%45 = load i32, i32* @EXIT_FAILURE
%46 = call i32 @exit(i32 %45)
unreachable
47: ; preds = %34
%48 = load i8*, i8** %6
%49 = call i32 @transformQueries(i8* %48)
store i32 %49, i32* %9
%50 = load i32, i32* %9
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %59
52: ; preds = %47
%53 = load i32, i32* @stderr
%54 = load i32, i32* %9
%55 = call i8* @processError(i32 %54)
%56 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %55)
%57 = load i32, i32* @EXIT_FAILURE
%58 = call i32 @exit(i32 %57)
unreachable
59: ; preds = %47
%60 = load i8*, i8** %8
%61 = load i8*, i8** %6
%62 = call i32 @saveQueries(i8* %60, i8* %61)
store i32 %62, i32* %9
%63 = load i32, i32* %9
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %72
65: ; preds = %59
%66 = load i32, i32* @stderr
%67 = load i32, i32* %9
%68 = call i8* @processError(i32 %67)
%69 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %68)
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %59
%73 = load i8*, i8** %6
%74 = call i32 @freeQueries(i8* %73)
store i32 %74, i32* %9
%75 = load i32, i32* %9
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %84
77: ; preds = %72
%78 = load i32, i32* @stderr
%79 = load i32, i32* %9
%80 = call i8* @processError(i32 %79)
%81 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %80)
%82 = load i32, i32* @EXIT_FAILURE
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %72
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
@str = [111 x i8] c"Usage: gcandidates distance regionsfile.prof\09\09 \0A example: bin/gcandidates 0.2 input/regions-score.1M.prof \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([111 x i8], [111 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
%9 = bitcast i8** %3 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call float @atof(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = call i32 @initQueries(i8** %3, float %12)
%16 = icmp eq i32 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %8
%18 = load i32, i32* @stderr
%19 = call i8* @processError(i32 %15)
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %8
%24 = load i8*, i8** %3
%25 = call i32 @loadQueries(i8* %14, i8* %24)
%26 = icmp eq i32 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %23
%28 = load i32, i32* @stderr
%29 = call i8* @processError(i32 %25)
%30 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = load i32, i32* @EXIT_FAILURE
%32 = call i32 @exit(i32 %31)
unreachable
33: ; preds = %23
%34 = load i8*, i8** %3
%35 = call i32 @transformQueries(i8* %34)
%36 = icmp eq i32 %35, 0
br i1 %36, label %43, label %37
37: ; preds = %33
%38 = load i32, i32* @stderr
%39 = call i8* @processError(i32 %35)
%40 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = load i32, i32* @EXIT_FAILURE
%42 = call i32 @exit(i32 %41)
unreachable
43: ; preds = %33
%44 = load i8*, i8** %3
%45 = call i32 @saveQueries(i8* %14, i8* %44)
%46 = icmp eq i32 %45, 0
br i1 %46, label %53, label %47
47: ; preds = %43
%48 = load i32, i32* @stderr
%49 = call i8* @processError(i32 %45)
%50 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %43
%54 = load i8*, i8** %3
%55 = call i32 @freeQueries(i8* %54)
%56 = icmp eq i32 %55, 0
br i1 %56, label %63, label %57
57: ; preds = %53
%58 = load i32, i32* @stderr
%59 = call i8* @processError(i32 %55)
%60 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %59)
%61 = load i32, i32* @EXIT_FAILURE
%62 = call i32 @exit(i32 %61)
unreachable
63: ; preds = %53
ret i32 0
}