#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*/ i2c_SCL_set(int);
int /*<<< orphan*/ i2c_SDA_set(int);
void i2c_send_raw_data(char v) {
  int i, d;
  i2c_SCL_set(0);
  for (i = 7; i >= 0; i--) {
    d = (v >> i) & 0x01;
    i2c_SDA_set(d);
    i2c_SCL_set(1);
    i2c_SCL_set(0);
  }
}


x86 assembly (clang, -O0):
<i2c_send_raw_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
movl   $0x7,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     117c <i2c_send_raw_data+0x5c>
movsbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113c <i2c_send_raw_data+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_send_raw_data>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
movzbl %bl,%ebp
mov    %ebp,%edi
shr    $0x7,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
mov    %ebp,%edi
shr    $0x6,%edi
and    $0x1,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
mov    %ebp,%edi
shr    $0x5,%edi
and    $0x1,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
mov    %ebp,%edi
shr    $0x4,%edi
and    $0x1,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
mov    %ebp,%edi
shr    $0x3,%edi
and    $0x1,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
mov    %ebp,%edi
shr    $0x2,%edi
and    $0x1,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
shr    %ebp
and    $0x1,%ebp
mov    %ebp,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
and    $0x1,%ebx
mov    %ebx,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1040 <i2c_SCL_set@plt>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <i2c_SCL_set@plt>

LLVM IR (-O0):
define void @i2c_send_raw_data(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i8 %0, i8* %2
%5 = call i32 @i2c_SCL_set(i32 0)
store i32 7, i32* %3
br label %6
6: ; preds = %19, %1
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = load i32, i32* %3
%13 = ashr i32 %11, %12
%14 = and i32 %13, 1
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = call i32 @i2c_SDA_set(i32 %15)
%17 = call i32 @i2c_SCL_set(i32 1)
%18 = call i32 @i2c_SCL_set(i32 0)
br label %19
19: ; preds = %9
%20 = load i32, i32* %3
%21 = add nsw i32 %20, -1
store i32 %21, i32* %3
br label %6
22: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @i2c_send_raw_data(i8 signext %0) {
%2 = tail call i32 @i2c_SCL_set(i32 0)
%3 = zext i8 %0 to i32
%4 = lshr i32 %3, 7
%5 = tail call i32 @i2c_SDA_set(i32 %4)
%6 = tail call i32 @i2c_SCL_set(i32 1)
%7 = tail call i32 @i2c_SCL_set(i32 0)
%8 = lshr i32 %3, 6
%9 = and i32 %8, 1
%10 = tail call i32 @i2c_SDA_set(i32 %9)
%11 = tail call i32 @i2c_SCL_set(i32 1)
%12 = tail call i32 @i2c_SCL_set(i32 0)
%13 = lshr i32 %3, 5
%14 = and i32 %13, 1
%15 = tail call i32 @i2c_SDA_set(i32 %14)
%16 = tail call i32 @i2c_SCL_set(i32 1)
%17 = tail call i32 @i2c_SCL_set(i32 0)
%18 = lshr i32 %3, 4
%19 = and i32 %18, 1
%20 = tail call i32 @i2c_SDA_set(i32 %19)
%21 = tail call i32 @i2c_SCL_set(i32 1)
%22 = tail call i32 @i2c_SCL_set(i32 0)
%23 = lshr i32 %3, 3
%24 = and i32 %23, 1
%25 = tail call i32 @i2c_SDA_set(i32 %24)
%26 = tail call i32 @i2c_SCL_set(i32 1)
%27 = tail call i32 @i2c_SCL_set(i32 0)
%28 = lshr i32 %3, 2
%29 = and i32 %28, 1
%30 = tail call i32 @i2c_SDA_set(i32 %29)
%31 = tail call i32 @i2c_SCL_set(i32 1)
%32 = tail call i32 @i2c_SCL_set(i32 0)
%33 = lshr i32 %3, 1
%34 = and i32 %33, 1
%35 = tail call i32 @i2c_SDA_set(i32 %34)
%36 = tail call i32 @i2c_SCL_set(i32 1)
%37 = tail call i32 @i2c_SCL_set(i32 0)
%38 = and i32 %3, 1
%39 = tail call i32 @i2c_SDA_set(i32 %38)
%40 = tail call i32 @i2c_SCL_set(i32 1)
%41 = tail call i32 @i2c_SCL_set(i32 0)
ret void
}