#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 /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int errno;
int open(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, void *, int);
void start_second(void *step_second) {
  int f = open("../epoch.rta/second", O_RDONLY, 0777);
  int x;
  if (f < 0)
    printf("epoch check not available %d\n", errno);
  else {
    x = read(f, step_second, 8);
    if (x ^ 8)
      printf("stored second unavailable\n");
  }
  close(f);
}


x86 assembly (clang, -O0):
<start_second>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
lea    0xea4(%rip),%rdi
mov    $0x1ff,%edx
call   1060 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    118f <start_second+0x4f>
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c5 <start_second+0x85>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1050 <read@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0x8,%eax
cmp    $0x0,%eax
je     11c0 <start_second+0x80>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c5 <start_second+0x85>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_second>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
lea    0xe99(%rip),%rdi
mov    $0x1ff,%edx
call   1070 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1199 <start_second+0x49>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1060 <read@plt>
cmp    $0x8,%eax
je     11b0 <start_second+0x60>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
jmp    11b0 <start_second+0x60>
mov    0x2e38(%rip),%rax
mov    (%rax),%esi
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <close@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"../epoch.rta/second\00"
@O_RDONLY = global i32 0
@.str.1 = [30 x i8] c"epoch check not available %d\0A\00"
@errno = global i32 0
@.str.2 = [27 x i8] c"stored second unavailable\0A\00"
define void @start_second(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5, i32 511)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* @errno
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %22
12: ; preds = %1
%13 = load i32, i32* %3
%14 = load i8*, i8** %2
%15 = call i32 @read(i32 %13, i8* %14, i32 8)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = xor i32 %16, 8
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %12
br label %22
22: ; preds = %21, %9
%23 = load i32, i32* %3
%24 = call i32 @close(i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"../epoch.rta/second\00"
@O_RDONLY = global i32 0
@.str.1 = [30 x i8] c"epoch check not available %d\0A\00"
@errno = global i32 0
@str = [26 x i8] c"stored second unavailable\00"
define void @start_second(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2, i32 511)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @errno
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %13
8: ; preds = %1
%9 = tail call i32 @read(i32 %3, i8* %0, i32 8)
%10 = icmp eq i32 %9, 8
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %8, %11, %5
%14 = tail call i32 @close(i32 %3)
ret void
}