#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 CheckPt_Latest(char *, int, double const, double const, double const,
                   double const);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int CheckPt_Test(int *CheckPtNum, int CheckFileExist,
                 char *FileNameCheckPtVersion, int FileNameSize,
                 const double Vx, const double Vy, const double Vz,
                 const double Temperature) {
  if (CheckFileExist == 0) {
    *CheckPtNum = CheckPt_Latest(FileNameCheckPtVersion, FileNameSize, Vx, Vy,
                                 Vz, Temperature);
    if (*CheckPtNum > 0) {
      *CheckPtNum = *CheckPtNum + 1;
      printf("CheckPoint file found for Vx %g Vy %g Vz %g and Temperature %g\n",
             Vx, Vy, Vz, Temperature);
      printf("File Name %s\n", FileNameCheckPtVersion);
      return 1;
    } else if (*CheckPtNum == 0) {
      printf("CheckPoint file does not exist for Vx %g Vy %g Vz %g and "
             "Temperature %g\n",
             Vx, Vy, Vz, Temperature);
      *CheckPtNum = 1;
      return 0;
    } else if (*CheckPtNum < 0) {
      printf("ERROR unable to open CHECKPOINT directory!\n");
      exit(1);
    }
  } else {
    *CheckPtNum = 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<CheckPt_Test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
movsd  %xmm2,-0x40(%rbp)
movsd  %xmm3,-0x48(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1261 <CheckPt_Test+0x131>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
call   1030 <CheckPt_Latest@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11e8 <CheckPt_Test+0xb8>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
lea    0xe3d(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1272 <CheckPt_Test+0x142>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    122d <CheckPt_Test+0xfd>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
lea    0xe3e(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1272 <CheckPt_Test+0x142>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1252 <CheckPt_Test+0x122>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    1257 <CheckPt_Test+0x127>
jmp    125c <CheckPt_Test+0x12c>
jmp    126b <CheckPt_Test+0x13b>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckPt_Test>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
test   %esi,%esi
je     1158 <CheckPt_Test+0x18>
movl   $0x1,(%rbx)
xor    %eax,%eax
jmp    11c4 <CheckPt_Test+0x84>
mov    %rdx,%r14
mov    %rdx,%rdi
mov    %ecx,%esi
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm3,0x20(%rsp)
call   1040 <CheckPt_Latest@plt>
mov    %eax,(%rbx)
test   %eax,%eax
jle    11cc <CheckPt_Test+0x8c>
add    $0x1,%eax
mov    %eax,(%rbx)
lea    0xe71(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
mov    $0x4,%al
call   1050 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
movsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
jne    11f9 <CheckPt_Test+0xb9>
lea    0xe61(%rip),%rdi
mov    $0x4,%al
call   1050 <printf@plt>
jmp    114e <CheckPt_Test+0xe>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"CheckPoint file found for Vx %g Vy %g Vz %g and Temperature %g\0A\00"
@.str.1 = [14 x i8] c"File Name %s\0A\00"
@.str.2 = [73 x i8] c"CheckPoint file does not exist for Vx %g Vy %g Vz %g and Temperature %g\0A\00"
@.str.3 = [44 x i8] c"ERROR unable to open CHECKPOINT directory!\0A\00"
define i32 @CheckPt_Test(i32* %0, i32 %1, i8* %2, i32 %3, double %4, double %5, double %6, double %7) {
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store i32* %0, i32** %10
store i32 %1, i32* %11
store i8* %2, i8** %12
store i32 %3, i32* %13
store double %4, double* %14
store double %5, double* %15
store double %6, double* %16
store double %7, double* %17
%18 = load i32, i32* %11
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %65
20: ; preds = %8
%21 = load i8*, i8** %12
%22 = load i32, i32* %13
%23 = load double, double* %14
%24 = load double, double* %15
%25 = load double, double* %16
%26 = load double, double* %17
%27 = call i32 @CheckPt_Latest(i8* %21, i32 %22, double %23, double %24, double %25, double %26)
%28 = load i32*, i32** %10
store i32 %27, i32* %28
%29 = load i32*, i32** %10
%30 = load i32, i32* %29
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %44
32: ; preds = %20
%33 = load i32*, i32** %10
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
%36 = load i32*, i32** %10
store i32 %35, i32* %36
%37 = load double, double* %14
%38 = load double, double* %15
%39 = load double, double* %16
%40 = load double, double* %17
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), double %37, double %38, double %39, double %40)
%42 = load i8*, i8** %12
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %42)
store i32 1, i32* %9
br label %68
44: ; preds = %20
%45 = load i32*, i32** %10
%46 = load i32, i32* %45
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %55
48: ; preds = %44
%49 = load double, double* %14
%50 = load double, double* %15
%51 = load double, double* %16
%52 = load double, double* %17
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0), double %49, double %50, double %51, double %52)
%54 = load i32*, i32** %10
store i32 1, i32* %54
store i32 0, i32* %9
br label %68
55: ; preds = %44
%56 = load i32*, i32** %10
%57 = load i32, i32* %56
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %55
br label %63
63: ; preds = %62
br label %64
64: ; preds = %63
br label %67
65: ; preds = %8
%66 = load i32*, i32** %10
store i32 1, i32* %66
br label %67
67: ; preds = %65, %64
store i32 0, i32* %9
br label %68
68: ; preds = %67, %48, %32
%69 = load i32, i32* %9
ret i32 %69
}

LLVM IR (-O2):
@.str = [64 x i8] c"CheckPoint file found for Vx %g Vy %g Vz %g and Temperature %g\0A\00"
@.str.1 = [14 x i8] c"File Name %s\0A\00"
@.str.2 = [73 x i8] c"CheckPoint file does not exist for Vx %g Vy %g Vz %g and Temperature %g\0A\00"
@str = [43 x i8] c"ERROR unable to open CHECKPOINT directory!\00"
define i32 @CheckPt_Test(i32* nocapture writeonly %0, i32 %1, i8* %2, i32 %3, double %4, double %5, double %6, double %7) {
%9 = icmp eq i32 %1, 0
br i1 %9, label %10, label %24
10: ; preds = %8
%11 = tail call i32 @CheckPt_Latest(i8* %2, i32 %3, double %4, double %5, double %6, double %7)
store i32 %11, i32* %0
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = add nuw nsw i32 %11, 1
store i32 %14, i32* %0
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), double %4, double %5, double %6, double %7)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %25
17: ; preds = %10
%18 = icmp eq i32 %11, 0
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0), double %4, double %5, double %6, double %7)
store i32 1, i32* %0
br label %25
21: ; preds = %17
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %8
store i32 1, i32* %0
br label %25
25: ; preds = %24, %19, %13
%26 = phi i32 [ 1, %13 ], [ 0, %19 ], [ 0, %24 ]
ret i32 %26
}