#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*/ one_int_read(int, unsigned int *);
int /*<<< orphan*/ one_int_write(int, int);
int /*<<< orphan*/ usleep(int);
int one_write_time(unsigned int addree, unsigned int num) {
  unsigned int tmpint;
  unsigned int data;
  one_int_write(0xb8115f24, 0x1);
  usleep(40000);
  one_int_read(0xb8115f2c, &tmpint);
  usleep(40000);
  one_int_write(0xb8115f00, 0x010ad079);
  usleep(40000);
  one_int_write(addree, num);
  usleep(40000);
  do {
    one_int_read(0xb8115f18, &data);
  } while (data & 0x1);
  one_int_write(0xb8115f24, 0x0);
  usleep(40000);
}


x86 assembly (clang, -O0):
<one_write_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0xb8115f24,%edi
mov    $0x1,%esi
call   1030 <one_int_write@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
mov    $0xb8115f2c,%edi
lea    -0x10(%rbp),%rsi
call   1040 <one_int_read@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
mov    $0xb8115f00,%edi
mov    $0x10ad079,%esi
call   1030 <one_int_write@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <one_int_write@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
mov    $0xb8115f18,%edi
lea    -0x14(%rbp),%rsi
call   1040 <one_int_read@plt>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    119d <one_write_time+0x6d>
mov    $0xb8115f24,%edi
xor    %esi,%esi
call   1030 <one_int_write@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<one_write_time>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0xb8115f24,%edi
mov    $0x1,%esi
call   1030 <one_int_write@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
lea    0x4(%rsp),%rsi
mov    $0xb8115f2c,%edi
call   1040 <one_int_read@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
mov    $0xb8115f00,%edi
mov    $0x10ad079,%esi
call   1030 <one_int_write@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <one_int_write@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    $0xb8115f18,%edi
mov    %rbx,%rsi
call   1040 <one_int_read@plt>
testb  $0x1,(%rsp)
jne    11a0 <one_write_time+0x70>
mov    $0xb8115f24,%edi
xor    %esi,%esi
call   1030 <one_int_write@plt>
mov    $0x9c40,%edi
call   1050 <usleep@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @one_write_time(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = call i32 @one_int_write(i32 -1206821084, i32 1)
%9 = call i32 @usleep(i32 40000)
%10 = call i32 @one_int_read(i32 -1206821076, i32* %6)
%11 = call i32 @usleep(i32 40000)
%12 = call i32 @one_int_write(i32 -1206821120, i32 17485945)
%13 = call i32 @usleep(i32 40000)
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @one_int_write(i32 %14, i32 %15)
%17 = call i32 @usleep(i32 40000)
br label %18
18: ; preds = %20, %2
%19 = call i32 @one_int_read(i32 -1206821096, i32* %7)
br label %20
20: ; preds = %18
%21 = load i32, i32* %7
%22 = and i32 %21, 1
%23 = icmp ne i32 %22, 0
br i1 %23, label %18, label %24
24: ; preds = %20
%25 = call i32 @one_int_write(i32 -1206821084, i32 0)
%26 = call i32 @usleep(i32 40000)
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @one_write_time(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @one_int_write(i32 -1206821084, i32 1)
%8 = tail call i32 @usleep(i32 40000)
%9 = call i32 @one_int_read(i32 -1206821076, i32* %3)
%10 = call i32 @usleep(i32 40000)
%11 = call i32 @one_int_write(i32 -1206821120, i32 17485945)
%12 = call i32 @usleep(i32 40000)
%13 = call i32 @one_int_write(i32 %0, i32 %1)
%14 = call i32 @usleep(i32 40000)
br label %15
15: ; preds = %15, %2
%16 = call i32 @one_int_read(i32 -1206821096, i32* %4)
%17 = load i32, i32* %4
%18 = and i32 %17, 1
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %15
20: ; preds = %15
%21 = call i32 @one_int_write(i32 -1206821084, i32 0)
%22 = call i32 @usleep(i32 40000)
ret i32 undef
}