#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(char);
void i2c_send_slave_adrs(char sa7, char r_wx) {
  int i, d;
  i2c_SCL_set(0);
  for (i = 6; i >= 0; i--) {
    d = (sa7 >> i) & 0x01;
    i2c_SDA_set(d);
    i2c_SCL_set(1);
    i2c_SCL_set(0);
  }
  i2c_SDA_set(r_wx & 0x01);
  i2c_SCL_set(1);
  i2c_SCL_set(0);
}


x86 assembly (clang, -O0):
<i2c_send_slave_adrs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
movl   $0x6,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1185 <i2c_send_slave_adrs+0x65>
movsbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsbl %al,%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    1142 <i2c_send_slave_adrs+0x22>
movsbl -0x2(%rbp),%eax
and    $0x1,%eax
movsbl %al,%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>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_send_slave_adrs>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
call   1040 <i2c_SCL_set@plt>
mov    %ebp,%eax
shr    $0x6,%al
and    $0x1,%al
movzbl %al,%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,%eax
shr    $0x5,%al
and    $0x1,%al
movzbl %al,%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,%eax
shr    $0x4,%al
and    $0x1,%al
movzbl %al,%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,%eax
shr    $0x3,%al
and    $0x1,%al
movzbl %al,%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,%eax
shr    $0x2,%al
and    $0x1,%al
movzbl %al,%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,%eax
shr    %al
and    $0x1,%al
movzbl %al,%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,%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_slave_adrs(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
%7 = call i32 @i2c_SCL_set(i32 0)
store i32 6, i32* %5
br label %8
8: ; preds = %22, %2
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = load i32, i32* %5
%15 = ashr i32 %13, %14
%16 = and i32 %15, 1
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = trunc i32 %17 to i8
%19 = call i32 @i2c_SDA_set(i8 signext %18)
%20 = call i32 @i2c_SCL_set(i32 1)
%21 = call i32 @i2c_SCL_set(i32 0)
br label %22
22: ; preds = %11
%23 = load i32, i32* %5
%24 = add nsw i32 %23, -1
store i32 %24, i32* %5
br label %8
25: ; preds = %8
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = and i32 %27, 1
%29 = trunc i32 %28 to i8
%30 = call i32 @i2c_SDA_set(i8 signext %29)
%31 = call i32 @i2c_SCL_set(i32 1)
%32 = call i32 @i2c_SCL_set(i32 0)
ret void
}

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