void iic_write(int slave_addr, int addr, int data) {
  (*(volatile unsigned *)0xE180000C) = slave_addr;
  (*(volatile unsigned *)0xE1800004) = 0xf0;
  while (((*(volatile unsigned *)0xE1800000) & 0x10) == 0)
    ;
  while (((*(volatile unsigned *)0xE1800004) & 0x1))
    ;
  (*(volatile unsigned *)0xE180000C) = addr << 1 | ((data >> 8) & 0x0001);
  (*(volatile unsigned *)0xE1800000) &= ~(1 << 4);
  while (((*(volatile unsigned *)0xE1800000) & 0x10) == 0)
    ;
  while (((*(volatile unsigned *)0xE1800004) & 0x1))
    ;
  (*(volatile unsigned *)0xE180000C) = (data & 0x00FF);
  (*(volatile unsigned *)0xE1800000) &= ~(1 << 4);
  while (((*(volatile unsigned *)0xE1800000) & 0x10) == 0)
    ;
  while (((*(volatile unsigned *)0xE1800004) & 0x1))
    ;
  (*(volatile unsigned *)0xE1800004) = 0xd0;
  (*(volatile unsigned *)0xE1800000) &= ~(1 << 4);
  int i = 0;
  for (i = 0; i < 50; i++)
    ;
  return;
}


x86 assembly (clang, -O0):
<iic_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0xe180000c,%eax
mov    %ecx,(%rax)
mov    $0xe1800004,%eax
movl   $0xf0,(%rax)
mov    $0xe1800000,%eax
mov    (%rax),%eax
and    $0x10,%eax
cmp    $0x0,%eax
jne    113a <iic_write+0x3a>
jmp    1122 <iic_write+0x22>
jmp    113f <iic_write+0x3f>
mov    $0xe1800004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1157 <iic_write+0x57>
jmp    113f <iic_write+0x3f>
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0x1,%eax
or     %eax,%ecx
mov    $0xe180000c,%eax
mov    %ecx,(%rax)
mov    $0xe1800000,%eax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    $0xe1800000,%eax
mov    %ecx,(%rax)
mov    $0xe1800000,%eax
mov    (%rax),%eax
and    $0x10,%eax
cmp    $0x0,%eax
jne    1198 <iic_write+0x98>
jmp    1180 <iic_write+0x80>
jmp    119d <iic_write+0x9d>
mov    $0xe1800004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11b5 <iic_write+0xb5>
jmp    119d <iic_write+0x9d>
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    $0xe180000c,%eax
mov    %ecx,(%rax)
mov    $0xe1800000,%eax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    $0xe1800000,%eax
mov    %ecx,(%rax)
mov    $0xe1800000,%eax
mov    (%rax),%eax
and    $0x10,%eax
cmp    $0x0,%eax
jne    11ee <iic_write+0xee>
jmp    11d6 <iic_write+0xd6>
jmp    11f3 <iic_write+0xf3>
mov    $0xe1800004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     120b <iic_write+0x10b>
jmp    11f3 <iic_write+0xf3>
mov    $0xe1800004,%eax
movl   $0xd0,(%rax)
mov    $0xe1800000,%eax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    $0xe1800000,%eax
mov    %ecx,(%rax)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x32,-0x10(%rbp)
jge    1252 <iic_write+0x152>
jmp    1244 <iic_write+0x144>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1235 <iic_write+0x135>
pop    %rbp
ret

x86 assembly (clang, -O2):
<iic_write>:
mov    $0xe1800000,%eax
mov    %edi,0xc(%rax)
movl   $0xf0,0x4(%rax)
nop
testl  $0x10,(%rax)
je     1110 <iic_write+0x10>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rax),%ecx
test   $0x1,%cl
jne    1120 <iic_write+0x20>
mov    %edx,%ecx
shr    $0x8,%ecx
and    $0x1,%ecx
lea    (%rcx,%rsi,2),%ecx
mov    %ecx,0xc(%rax)
andl   $0xffffffef,(%rax)
nopl   0x0(%rax)
testl  $0x10,(%rax)
je     1140 <iic_write+0x40>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rax),%ecx
test   $0x1,%cl
jne    1150 <iic_write+0x50>
movzbl %dl,%ecx
mov    %ecx,0xc(%rax)
andl   $0xffffffef,(%rax)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
testl  $0x10,(%rax)
je     1170 <iic_write+0x70>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rax),%ecx
test   $0x1,%cl
jne    1180 <iic_write+0x80>
movl   $0xd0,0x4(%rax)
andl   $0xffffffef,(%rax)
ret

LLVM IR (-O0):
define void @iic_write(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
store volatile i32 %8, i32* inttoptr (i64 3783262220 to i32*)
store volatile i32 240, i32* inttoptr (i64 3783262212 to i32*)
br label %9
9: ; preds = %13, %3
%10 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%11 = and i32 %10, 16
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
br label %9
14: ; preds = %9
br label %15
15: ; preds = %19, %14
%16 = load volatile i32, i32* inttoptr (i64 3783262212 to i32*)
%17 = and i32 %16, 1
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
br label %15
20: ; preds = %15
%21 = load i32, i32* %5
%22 = shl i32 %21, 1
%23 = load i32, i32* %6
%24 = ashr i32 %23, 8
%25 = and i32 %24, 1
%26 = or i32 %22, %25
store volatile i32 %26, i32* inttoptr (i64 3783262220 to i32*)
%27 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%28 = and i32 %27, -17
store volatile i32 %28, i32* inttoptr (i64 3783262208 to i32*)
br label %29
29: ; preds = %33, %20
%30 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%31 = and i32 %30, 16
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29
br label %29
34: ; preds = %29
br label %35
35: ; preds = %39, %34
%36 = load volatile i32, i32* inttoptr (i64 3783262212 to i32*)
%37 = and i32 %36, 1
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %35
br label %35
40: ; preds = %35
%41 = load i32, i32* %6
%42 = and i32 %41, 255
store volatile i32 %42, i32* inttoptr (i64 3783262220 to i32*)
%43 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%44 = and i32 %43, -17
store volatile i32 %44, i32* inttoptr (i64 3783262208 to i32*)
br label %45
45: ; preds = %49, %40
%46 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%47 = and i32 %46, 16
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %45
br label %45
50: ; preds = %45
br label %51
51: ; preds = %55, %50
%52 = load volatile i32, i32* inttoptr (i64 3783262212 to i32*)
%53 = and i32 %52, 1
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %51
br label %51
56: ; preds = %51
store volatile i32 208, i32* inttoptr (i64 3783262212 to i32*)
%57 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%58 = and i32 %57, -17
store volatile i32 %58, i32* inttoptr (i64 3783262208 to i32*)
store i32 0, i32* %7
store i32 0, i32* %7
br label %59
59: ; preds = %63, %56
%60 = load i32, i32* %7
%61 = icmp slt i32 %60, 50
br i1 %61, label %62, label %66
62: ; preds = %59
br label %63
63: ; preds = %62
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
store i32 %65, i32* %7
br label %59
66: ; preds = %59
ret void
}

LLVM IR (-O2):
define void @iic_write(i32 %0, i32 %1, i32 %2) {
store volatile i32 %0, i32* inttoptr (i64 3783262220 to i32*)
store volatile i32 240, i32* inttoptr (i64 3783262212 to i32*)
br label %4
4: ; preds = %4, %3
%5 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%6 = and i32 %5, 16
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4, %8
%9 = load volatile i32, i32* inttoptr (i64 3783262212 to i32*)
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %8
12: ; preds = %8
%13 = shl i32 %1, 1
%14 = lshr i32 %2, 8
%15 = and i32 %14, 1
%16 = or i32 %15, %13
store volatile i32 %16, i32* inttoptr (i64 3783262220 to i32*)
%17 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%18 = and i32 %17, -17
store volatile i32 %18, i32* inttoptr (i64 3783262208 to i32*)
br label %19
19: ; preds = %19, %12
%20 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%21 = and i32 %20, 16
%22 = icmp eq i32 %21, 0
br i1 %22, label %19, label %23
23: ; preds = %19, %23
%24 = load volatile i32, i32* inttoptr (i64 3783262212 to i32*)
%25 = and i32 %24, 1
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %23
27: ; preds = %23
%28 = and i32 %2, 255
store volatile i32 %28, i32* inttoptr (i64 3783262220 to i32*)
%29 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%30 = and i32 %29, -17
store volatile i32 %30, i32* inttoptr (i64 3783262208 to i32*)
br label %31
31: ; preds = %31, %27
%32 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%33 = and i32 %32, 16
%34 = icmp eq i32 %33, 0
br i1 %34, label %31, label %35
35: ; preds = %31, %35
%36 = load volatile i32, i32* inttoptr (i64 3783262212 to i32*)
%37 = and i32 %36, 1
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %35
39: ; preds = %35
store volatile i32 208, i32* inttoptr (i64 3783262212 to i32*)
%40 = load volatile i32, i32* inttoptr (i64 3783262208 to i32*)
%41 = and i32 %40, -17
store volatile i32 %41, i32* inttoptr (i64 3783262208 to i32*)
ret void
}