#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 */
scalar_t__ EINTR;
scalar_t__ errno;
int mkdir(char *, int);
int /*<<< orphan*/ update_exception_counter(char *);
void do_reboot_count_file() {
  int ret;
  do {
    ret = mkdir("/data/fih_statistics", 0777);
  } while (ret < 0 && errno == EINTR);
  update_exception_counter("/data/fih_statistics"
                           "/abnormal_power_on.log");
}


x86 assembly (clang, -O0):
<do_reboot_count_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jge    1165 <do_reboot_count_file+0x45>
mov    0x2e8e(%rip),%rax
mov    (%rax),%rax
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1128 <do_reboot_count_file+0x8>
lea    0xe9e(%rip),%rdi
call   1040 <update_exception_counter@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_reboot_count_file>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%r14
mov    0x2ead(%rip),%r15
mov    0x2e9e(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
test   %eax,%eax
jns    1159 <do_reboot_count_file+0x39>
mov    (%rbx),%rax
cmp    %rax,(%r15)
je     1140 <do_reboot_count_file+0x20>
lea    0xeb5(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <update_exception_counter@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"/data/fih_statistics\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.1 = [43 x i8] c"/data/fih_statistics/abnormal_power_on.log\00"
define void @do_reboot_count_file() {
%1 = alloca i32
br label %2
2: ; preds = %11, %0
%3 = call i32 @mkdir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 511)
store i32 %3, i32* %1
br label %4
4: ; preds = %2
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i64, i64* @errno
%9 = load i64, i64* @EINTR
%10 = icmp eq i64 %8, %9
br label %11
11: ; preds = %7, %4
%12 = phi i1 [ false, %4 ], [ %10, %7 ]
br i1 %12, label %2, label %13
13: ; preds = %11
%14 = call i32 @update_exception_counter(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"/data/fih_statistics\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.1 = [43 x i8] c"/data/fih_statistics/abnormal_power_on.log\00"
define void @do_reboot_count_file() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @mkdir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 511)
%3 = icmp slt i32 %2, 0
%4 = load i64, i64* @errno
%5 = load i64, i64* @EINTR
%6 = icmp eq i64 %4, %5
%7 = select i1 %3, i1 %6, i1 false
br i1 %7, label %1, label %8
8: ; preds = %1
%9 = tail call i32 @update_exception_counter(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret void
}