#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ print_time();
int /*<<< orphan*/ printf(char *);
int check_cronexec_do(int logexpr) {
  FILE *fp;
  int i_retval;
  i_retval = 0;
  fp = fopen(".cronexec_pause", "rb");
  if (fp == NULL) {
    i_retval = 1;
  } else {
    if (logexpr) {
      print_time();
      printf("cron_job_cancel : found_pause_file\n");
    }
    fclose(fp);
  }
  return i_retval;
}


x86 assembly (clang, -O0):
<check_cronexec_do>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea7(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1180 <check_cronexec_do+0x40>
movl   $0x1,-0x14(%rbp)
jmp    11a6 <check_cronexec_do+0x66>
cmpl   $0x0,-0x4(%rbp)
je     119d <check_cronexec_do+0x5d>
mov    $0x0,%al
call   1050 <print_time@plt>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_cronexec_do>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xeb4(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1183 <check_cronexec_do+0x43>
mov    %rax,%rbx
test   %ebp,%ebp
je     1177 <check_cronexec_do+0x37>
xor    %eax,%eax
call   1050 <print_time@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    1188 <check_cronexec_do+0x48>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c".cronexec_pause\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [36 x i8] c"cron_job_cancel : found_pause_file\0A\00"
define i32 @check_cronexec_do(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
%5 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %4
br label %18
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = call i32 (...) @print_time()
%14 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %12, %9
%16 = load i32*, i32** %3
%17 = call i32 @fclose(i32* %16)
br label %18
18: ; preds = %15, %8
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
@.str = [16 x i8] c".cronexec_pause\00"
@.str.1 = [3 x i8] c"rb\00"
@str = [35 x i8] c"cron_job_cancel : found_pause_file\00"
define i32 @check_cronexec_do(i32 %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = icmp eq i32 %0, 0
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = tail call i32 (...) @print_time()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %6, %4
%10 = tail call i32 @fclose(i32* %2)
br label %11
11: ; preds = %1, %9
%12 = phi i32 [ 0, %9 ], [ 1, %1 ]
ret i32 %12
}