#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_CELIV(char *, int, double const);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int CheckPt_Test_CELIV(int *CheckPtNum, int CheckFileExist,
                       char *FileNameCheckPtVersion, int FileNameSize,
                       const double Temperature) {
  if (CheckFileExist == 0) {
    *CheckPtNum =
        CheckPt_Latest_CELIV(FileNameCheckPtVersion, FileNameSize, Temperature);
    if (*CheckPtNum > 0) {
      *CheckPtNum = *CheckPtNum + 1;
      printf("CELIV CheckPoint file found for Temperature %g\n", Temperature);
      printf("File Name %s\n", FileNameCheckPtVersion);
      return 1;
    } else if (*CheckPtNum == 0) {
      printf("CELIV CheckPoint file does not exist for Temperature %g\n",
             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_CELIV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1225 <CheckPt_Test_CELIV+0xf5>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
movsd  -0x30(%rbp),%xmm0
call   1040 <CheckPt_Latest_CELIV@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11bb <CheckPt_Test_CELIV+0x8b>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x30(%rbp),%xmm0
lea    0xe6a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1236 <CheckPt_Test_CELIV+0x106>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11f1 <CheckPt_Test_CELIV+0xc1>
movsd  -0x30(%rbp),%xmm0
lea    0xe6a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1236 <CheckPt_Test_CELIV+0x106>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1216 <CheckPt_Test_CELIV+0xe6>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    121b <CheckPt_Test_CELIV+0xeb>
jmp    1220 <CheckPt_Test_CELIV+0xf0>
jmp    122f <CheckPt_Test_CELIV+0xff>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckPt_Test_CELIV>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %esi,%esi
je     1155 <CheckPt_Test_CELIV+0x15>
movl   $0x1,(%rbx)
xor    %eax,%eax
jmp    119b <CheckPt_Test_CELIV+0x5b>
mov    %rdx,%r14
mov    %rdx,%rdi
mov    %ecx,%esi
movsd  %xmm0,(%rsp)
call   1050 <CheckPt_Latest_CELIV@plt>
mov    %eax,(%rbx)
test   %eax,%eax
jle    11a3 <CheckPt_Test_CELIV+0x63>
add    $0x1,%eax
mov    %eax,(%rbx)
lea    0xe87(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
movsd  (%rsp),%xmm0
jne    11ba <CheckPt_Test_CELIV+0x7a>
lea    0xe8d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    114b <CheckPt_Test_CELIV+0xb>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

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

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