#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 _i2c_get(int);
int /*<<< orphan*/ _i2c_set(int, unsigned int);
int /*<<< orphan*/ _i2c_stop();
void _i2c_start(unsigned int connector) {
  unsigned int tmp;
  tmp = _i2c_get(0x7d50);
  if (tmp != 1) {
    _i2c_set(0x7d50, (1 << 0));
    _i2c_stop();
    _i2c_set(0x7d38, ((1 << 8) | connector));
    tmp = _i2c_get(0x7d3c) & (~0xff) & (~(0xf << 8));
    _i2c_set(0x7d3c, tmp | 1);
  }
  tmp = _i2c_get(0x7d38);
  _i2c_set(0x7d38, tmp | (1 << 8));
}


x86 assembly (clang, -O0):
<_i2c_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x7d50,%edi
call   1040 <_i2c_get@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     11a2 <_i2c_start+0x72>
mov    $0x7d50,%edi
mov    $0x1,%esi
call   1050 <_i2c_set@plt>
mov    $0x0,%al
call   1030 <_i2c_stop@plt>
mov    -0x4(%rbp),%esi
or     $0x100,%esi
mov    $0x7d38,%edi
call   1050 <_i2c_set@plt>
mov    $0x7d3c,%edi
call   1040 <_i2c_get@plt>
and    $0xffffff00,%eax
and    $0xfffff0ff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
or     $0x1,%esi
mov    $0x7d3c,%edi
call   1050 <_i2c_set@plt>
mov    $0x7d38,%edi
call   1040 <_i2c_get@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
or     $0x100,%esi
mov    $0x7d38,%edi
call   1050 <_i2c_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_i2c_start>:
push   %rbx
mov    %edi,%ebx
mov    $0x7d50,%edi
call   1040 <_i2c_get@plt>
cmp    $0x1,%eax
je     1186 <_i2c_start+0x56>
mov    $0x7d50,%edi
mov    $0x1,%esi
call   1050 <_i2c_set@plt>
xor    %eax,%eax
call   1030 <_i2c_stop@plt>
or     $0x100,%ebx
mov    $0x7d38,%edi
mov    %ebx,%esi
call   1050 <_i2c_set@plt>
mov    $0x7d3c,%edi
call   1040 <_i2c_get@plt>
and    $0xfffff000,%eax
lea    0x1(%rax),%esi
mov    $0x7d3c,%edi
call   1050 <_i2c_set@plt>
mov    $0x7d38,%edi
call   1040 <_i2c_get@plt>
or     $0x100,%eax
mov    $0x7d38,%edi
mov    %eax,%esi
pop    %rbx
jmp    1050 <_i2c_set@plt>

LLVM IR (-O0):
define void @_i2c_start(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @_i2c_get(i32 32080)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 1
br i1 %6, label %7, label %19
7: ; preds = %1
%8 = call i32 @_i2c_set(i32 32080, i32 1)
%9 = call i32 (...) @_i2c_stop()
%10 = load i32, i32* %2
%11 = or i32 256, %10
%12 = call i32 @_i2c_set(i32 32056, i32 %11)
%13 = call i32 @_i2c_get(i32 32060)
%14 = and i32 %13, -256
%15 = and i32 %14, -3841
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = or i32 %16, 1
%18 = call i32 @_i2c_set(i32 32060, i32 %17)
br label %19
19: ; preds = %7, %1
%20 = call i32 @_i2c_get(i32 32056)
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = or i32 %21, 256
%23 = call i32 @_i2c_set(i32 32056, i32 %22)
ret void
}

LLVM IR (-O2):
define void @_i2c_start(i32 %0) {
%2 = tail call i32 @_i2c_get(i32 32080)
%3 = icmp eq i32 %2, 1
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = tail call i32 @_i2c_set(i32 32080, i32 1)
%6 = tail call i32 (...) @_i2c_stop()
%7 = or i32 %0, 256
%8 = tail call i32 @_i2c_set(i32 32056, i32 %7)
%9 = tail call i32 @_i2c_get(i32 32060)
%10 = and i32 %9, -4096
%11 = or i32 %10, 1
%12 = tail call i32 @_i2c_set(i32 32060, i32 %11)
br label %13
13: ; preds = %4, %1
%14 = tail call i32 @_i2c_get(i32 32056)
%15 = or i32 %14, 256
%16 = tail call i32 @_i2c_set(i32 32056, i32 %15)
ret void
}