#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*/ OS_udelay(int);
int write_whitney(int, int);
int LLI2C_output_data(int state) {
  int err;
  if (state) {
    err = write_whitney(0x5014, 0x0100);
    if (err)
      return err;
    err = write_whitney(0x5014, 0x0000);
    if (err)
      return err;
  } else {
    err = write_whitney(0x5014, 0x0300);
    if (err)
      return err;
    err = write_whitney(0x5014, 0x0200);
    if (err)
      return err;
  }
  OS_udelay(1);
  return 0;
}


x86 assembly (clang, -O0):
<LLI2C_output_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1185 <LLI2C_output_data+0x65>
mov    $0x5014,%edi
mov    $0x100,%esi
call   1040 <write_whitney@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     115c <LLI2C_output_data+0x3c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e9 <LLI2C_output_data+0xc9>
mov    $0x5014,%edi
xor    %esi,%esi
call   1040 <write_whitney@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1180 <LLI2C_output_data+0x60>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e9 <LLI2C_output_data+0xc9>
jmp    11d8 <LLI2C_output_data+0xb8>
mov    $0x5014,%edi
mov    $0x300,%esi
call   1040 <write_whitney@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11ac <LLI2C_output_data+0x8c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e9 <LLI2C_output_data+0xc9>
mov    $0x5014,%edi
mov    $0x200,%esi
call   1040 <write_whitney@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11d3 <LLI2C_output_data+0xb3>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e9 <LLI2C_output_data+0xc9>
jmp    11d8 <LLI2C_output_data+0xb8>
mov    $0x1,%edi
call   1030 <OS_udelay@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LLI2C_output_data>:
push   %rax
test   %edi,%edi
je     113a <LLI2C_output_data+0x1a>
mov    $0x5014,%edi
mov    $0x100,%esi
call   1040 <write_whitney@plt>
test   %eax,%eax
je     1159 <LLI2C_output_data+0x39>
pop    %rcx
ret
mov    $0x5014,%edi
mov    $0x300,%esi
call   1040 <write_whitney@plt>
test   %eax,%eax
jne    1138 <LLI2C_output_data+0x18>
mov    $0x5014,%edi
mov    $0x200,%esi
jmp    1160 <LLI2C_output_data+0x40>
mov    $0x5014,%edi
xor    %esi,%esi
call   1040 <write_whitney@plt>
test   %eax,%eax
jne    1138 <LLI2C_output_data+0x18>
mov    $0x1,%edi
call   1030 <OS_udelay@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @LLI2C_output_data(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %1
%8 = call i32 @write_whitney(i32 20500, i32 256)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = load i32, i32* %4
store i32 %12, i32* %2
br label %35
13: ; preds = %7
%14 = call i32 @write_whitney(i32 20500, i32 0)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load i32, i32* %4
store i32 %18, i32* %2
br label %35
19: ; preds = %13
br label %33
20: ; preds = %1
%21 = call i32 @write_whitney(i32 20500, i32 768)
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = load i32, i32* %4
store i32 %25, i32* %2
br label %35
26: ; preds = %20
%27 = call i32 @write_whitney(i32 20500, i32 512)
store i32 %27, i32* %4
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i32, i32* %4
store i32 %31, i32* %2
br label %35
32: ; preds = %26
br label %33
33: ; preds = %32, %19
%34 = call i32 @OS_udelay(i32 1)
store i32 0, i32* %2
br label %35
35: ; preds = %33, %30, %24, %17, %11
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @LLI2C_output_data(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i32 @write_whitney(i32 20500, i32 256)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = tail call i32 @write_whitney(i32 20500, i32 0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %15, label %17
9: ; preds = %1
%10 = tail call i32 @write_whitney(i32 20500, i32 768)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = tail call i32 @write_whitney(i32 20500, i32 512)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12, %6
%16 = tail call i32 @OS_udelay(i32 1)
br label %17
17: ; preds = %12, %9, %6, %3, %15
%18 = phi i32 [ 0, %15 ], [ %4, %3 ], [ %7, %6 ], [ %10, %9 ], [ %13, %12 ]
ret i32 %18
}