#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 scalar_t__ time_t;
struct utsname {
  int dummy;
};

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int i, j, s, num_k_iter, num_secs = 1;
  time_t old_time, new_time;
  float x = 45;
  float y = 23;
  float z = 256;
  int success = 1;
  struct utsname uname_s;
  if (argc >= 2) {
    num_secs = atoi(argv[1]);
  }
  if (num_secs < 1) {
    num_secs = 1;
  }
  old_time = time(NULL);
  s = 0;
  while (s < num_secs) {
    for (j = 0; j < 10000; j++) {
      if ((x + y) >= z) {
        printf("error: floating point comparison failed on "
               "sec: %d, i: %d, j: %d\n",
               s, i, j);
        success = 0;
      }
    }
    new_time = time(NULL);
    if (new_time > old_time) {
      old_time = new_time;
      s++;
    }
  }
  if (success) {
    printf("Program completed successfully.\n");
    printf("Be sure that it checkpointed at least once.\n");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
movss  0xeb3(%rip),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  0xea2(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  0xe91(%rip),%xmm0
movss  %xmm0,-0x44(%rbp)
movl   $0x1,-0x48(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1195 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jge    11a6 <main+0x76>
movl   $0x1,-0x24(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1250 <main+0x120>
movl   $0x0,-0x18(%rbp)
cmpl   $0x2710,-0x18(%rbp)
jge    121f <main+0xef>
movss  -0x3c(%rbp),%xmm0
addss  -0x40(%rbp),%xmm0
ucomiss -0x44(%rbp),%xmm0
jb     120c <main+0xdc>
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x48(%rbp)
jmp    1211 <main+0xe1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11cd <main+0x9d>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
jle    124b <main+0x11b>
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ba <main+0x8a>
cmpl   $0x0,-0x48(%rbp)
je     1282 <main+0x152>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1289 <main+0x159>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%r14d
cmp    $0x2,%edi
jl     1154 <main+0x24>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
test   %eax,%eax
mov    $0x1,%r14d
cmovg  %eax,%r14d
xor    %ebp,%ebp
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1040 <time@plt>
xor    %ecx,%ecx
cmp    %rbx,%rax
setg   %cl
cmovg  %rax,%rbx
add    %ecx,%ebp
cmp    %r14d,%ebp
jb     1160 <main+0x30>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.utsname = type { i32 }
@.str = [66 x i8] c"error: floating point comparison failed on sec: %d, i: %d, j: %d\0A\00"
@.str.1 = [33 x i8] c"Program completed successfully.\0A\00"
@.str.2 = [45 x i8] c"Be sure that it checkpointed at least once.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca i32
%17 = alloca %struct.utsname
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %10
store float 4.500000e+01, float* %13
store float 2.300000e+01, float* %14
store float 2.560000e+02, float* %15
store i32 1, i32* %16
%18 = load i32, i32* %4
%19 = icmp sge i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %10
br label %25
25: ; preds = %20, %2
%26 = load i32, i32* %10
%27 = icmp slt i32 %26, 1
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 1, i32* %10
br label %29
29: ; preds = %28, %25
%30 = call i64 @time(i32* null)
store i64 %30, i64* %11
store i32 0, i32* %8
br label %31
31: ; preds = %63, %29
%32 = load i32, i32* %8
%33 = load i32, i32* %10
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %64
35: ; preds = %31
store i32 0, i32* %7
br label %36
36: ; preds = %51, %35
%37 = load i32, i32* %7
%38 = icmp slt i32 %37, 10000
br i1 %38, label %39, label %54
39: ; preds = %36
%40 = load float, float* %13
%41 = load float, float* %14
%42 = fadd float %40, %41
%43 = load float, float* %15
%44 = fcmp oge float %42, %43
br i1 %44, label %45, label %50
45: ; preds = %39
%46 = load i32, i32* %8
%47 = load i32, i32* %6
%48 = load i32, i32* %7
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %46, i32 %47, i32 %48)
store i32 0, i32* %16
br label %50
50: ; preds = %45, %39
br label %51
51: ; preds = %50
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %36
54: ; preds = %36
%55 = call i64 @time(i32* null)
store i64 %55, i64* %12
%56 = load i64, i64* %12
%57 = load i64, i64* %11
%58 = icmp sgt i64 %56, %57
br i1 %58, label %59, label %63
59: ; preds = %54
%60 = load i64, i64* %12
store i64 %60, i64* %11
%61 = load i32, i32* %8
%62 = add nsw i32 %61, 1
store i32 %62, i32* %8
br label %63
63: ; preds = %59, %54
br label %31
64: ; preds = %31
%65 = load i32, i32* %16
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %64
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %71
70: ; preds = %64
store i32 1, i32* %3
br label %71
71: ; preds = %70, %67
%72 = load i32, i32* %3
ret i32 %72
}

LLVM IR (-O2):
@str = [32 x i8] c"Program completed successfully.\00"
@str.3 = [44 x i8] c"Be sure that it checkpointed at least once.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp sgt i32 %7, 1
%9 = select i1 %8, i32 %7, i32 1
br label %10
10: ; preds = %4, %2
%11 = phi i32 [ 1, %2 ], [ %9, %4 ]
%12 = tail call i64 @time(i32* null)
br label %13
13: ; preds = %10, %13
%14 = phi i32 [ 0, %10 ], [ %20, %13 ]
%15 = phi i64 [ %12, %10 ], [ %18, %13 ]
%16 = tail call i64 @time(i32* null)
%17 = icmp sgt i64 %16, %15
%18 = select i1 %17, i64 %16, i64 %15
%19 = zext i1 %17 to i32
%20 = add nuw nsw i32 %14, %19
%21 = icmp ult i32 %20, %11
br i1 %21, label %13, label %22
22: ; preds = %13
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}