#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 errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ print_time();
int /*<<< orphan*/ printf(char *, ...);
char *strerror(int);
int make_pause_file(void) {
  FILE *fp;
  int i_retval;
  i_retval = 0;
  print_time();
  fp = fopen(".schedexec_pause", "w+b");
  if (fp != NULL) {
    fclose(fp);
    printf("schedule_job_create_pause_file\n");
    i_retval = 1;
  } else {
    printf("schedule_job_make_pause_file_error : %s (%d)\n", strerror(errno),
           errno);
  }
  return i_retval;
}


x86 assembly (clang, -O0):
<make_pause_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <print_time@plt>
lea    0xe93(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11ab <make_pause_file+0x5b>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    11d3 <make_pause_file+0x83>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    %rax,%rsi
mov    0x2e1d(%rip),%rax
mov    (%rax),%edx
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_pause_file>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <print_time@plt>
lea    0xe8c(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11a0 <make_pause_file+0x40>
mov    %rax,%rdi
call   1040 <fclose@plt>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    11c3 <make_pause_file+0x63>
mov    0x2e39(%rip),%r14
mov    (%r14),%edi
call   1080 <strerror@plt>
mov    (%r14),%edx
lea    0xe5c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c".schedexec_pause\00"
@.str.1 = [4 x i8] c"w+b\00"
@.str.2 = [32 x i8] c"schedule_job_create_pause_file\0A\00"
@.str.3 = [46 x i8] c"schedule_job_make_pause_file_error : %s (%d)\0A\00"
@errno = global i32 0
define i32 @make_pause_file() {
%1 = alloca i32*
%2 = alloca i32
store i32 0, i32* %2
%3 = call i32 (...) @print_time()
%4 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load i32*, i32** %1
%9 = call i32 @fclose(i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %16
11: ; preds = %0
%12 = load i32, i32* @errno
%13 = call i8* @strerror(i32 %12)
%14 = load i32, i32* @errno
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %13, i32 %14)
br label %16
16: ; preds = %11, %7
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@.str = [17 x i8] c".schedexec_pause\00"
@.str.1 = [4 x i8] c"w+b\00"
@.str.3 = [46 x i8] c"schedule_job_make_pause_file_error : %s (%d)\0A\00"
@errno = global i32 0
@str = [31 x i8] c"schedule_job_create_pause_file\00"
define i32 @make_pause_file() {
%1 = tail call i32 (...) @print_time()
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i32 @fclose(i32* %2)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %12
7: ; preds = %0
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = load i32, i32* @errno
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %9, i32 %10)
br label %12
12: ; preds = %7, %4
%13 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %13
}