#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*/ usleep(int);
int /*<<< orphan*/ write_file(char *, int /*<<< orphan*/, char *);
int resetn_low(void) {
  if (!write_file("/sys/class/gpio/gpio8/value", 0, "1\n"))
    goto err;
  usleep(1000);
  if (!write_file("/sys/class/gpio/gpio8/value", 0, "0\n"))
    goto err;
  usleep(25000);
  return 1;
err:
  return 0;
}


x86 assembly (clang, -O0):
<resetn_low>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
xor    %esi,%esi
lea    0xee4(%rip),%rdx
call   1030 <write_file@plt>
cmp    $0x0,%eax
jne    114b <resetn_low+0x2b>
jmp    118e <resetn_low+0x6e>
mov    $0x3e8,%edi
call   1040 <usleep@plt>
lea    0xea4(%rip),%rdi
xor    %esi,%esi
lea    0xeba(%rip),%rdx
call   1030 <write_file@plt>
cmp    $0x0,%eax
jne    1178 <resetn_low+0x58>
jmp    118e <resetn_low+0x6e>
mov    $0x61a8,%edi
call   1040 <usleep@plt>
movl   $0x1,-0x4(%rbp)
jmp    1195 <resetn_low+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resetn_low>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xeed(%rip),%rdx
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <write_file@plt>
test   %eax,%eax
je     1170 <resetn_low+0x50>
mov    $0x3e8,%edi
call   1040 <usleep@plt>
lea    0xeb3(%rip),%rdi
lea    0xecb(%rip),%rdx
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <write_file@plt>
test   %eax,%eax
je     1170 <resetn_low+0x50>
mov    $0x61a8,%edi
call   1040 <usleep@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"/sys/class/gpio/gpio8/value\00"
@.str.1 = [3 x i8] c"1\0A\00"
@.str.2 = [3 x i8] c"0\0A\00"
define i32 @resetn_low() {
%1 = alloca i32
%2 = call i32 @write_file(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp ne i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %0
br label %12
5: ; preds = %0
%6 = call i32 @usleep(i32 1000)
%7 = call i32 @write_file(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %5
br label %12
10: ; preds = %5
%11 = call i32 @usleep(i32 25000)
store i32 1, i32* %1
br label %13
12: ; preds = %9, %4
store i32 0, i32* %1
br label %13
13: ; preds = %12, %10
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [28 x i8] c"/sys/class/gpio/gpio8/value\00"
@.str.1 = [3 x i8] c"1\0A\00"
@.str.2 = [3 x i8] c"0\0A\00"
define i32 @resetn_low() {
%1 = tail call i32 @write_file(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = tail call i32 @usleep(i32 1000)
%5 = tail call i32 @write_file(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @usleep(i32 25000)
br label %9
9: ; preds = %0, %3, %7
%10 = phi i32 [ 1, %7 ], [ 0, %3 ], [ 0, %0 ]
ret i32 %10
}