#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*/ liic_delay_(unsigned int);
scalar_t__ liic_scl_(unsigned int, int);
int liic_sda_(unsigned int, int);
int send(unsigned num, int c) {
  for (int i = 0; i < 9; ++i) {
    liic_scl_(num, 0);
    if (i == 8) {
      liic_sda_(num, 1);
    } else {
      liic_sda_(num, c & 0x80);
      c <<= 1;
    }
    liic_delay_(num);
    while (liic_scl_(num, 1) == 0)
      ;
    liic_delay_(num);
  }
  return liic_sda_(num, 1);
}


x86 assembly (clang, -O0):
<send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    11c9 <send+0x99>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
cmpl   $0x8,-0xc(%rbp)
jne    1175 <send+0x45>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1050 <liic_sda_@plt>
jmp    118f <send+0x5f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
and    $0x80,%esi
call   1050 <liic_sda_@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <liic_delay_@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
cmp    $0x0,%rax
jne    11b3 <send+0x83>
jmp    1197 <send+0x67>
mov    -0x4(%rbp),%edi
call   1040 <liic_delay_@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1145 <send+0x15>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1050 <liic_sda_@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
cmp    $0x8,%ebp
jne    1160 <send+0x30>
mov    %ebx,%edi
mov    $0x1,%esi
call   1050 <liic_sda_@plt>
jmp    1173 <send+0x43>
nopl   0x0(%rax)
mov    %r14d,%esi
and    $0x80,%esi
mov    %ebx,%edi
call   1050 <liic_sda_@plt>
add    %r14d,%r14d
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
test   %rax,%rax
je     1180 <send+0x50>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
add    $0x1,%ebp
cmp    $0x9,%ebp
jne    1140 <send+0x10>
mov    %ebx,%edi
mov    $0x1,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <liic_sda_@plt>

LLVM IR (-O0):
define i32 @send(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %35, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 9
br i1 %8, label %9, label %38
9: ; preds = %6
%10 = load i32, i32* %3
%11 = call i64 @liic_scl_(i32 %10, i32 0)
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 8
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %3
%16 = call i32 @liic_sda_(i32 %15, i32 1)
br label %24
17: ; preds = %9
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = and i32 %19, 128
%21 = call i32 @liic_sda_(i32 %18, i32 %20)
%22 = load i32, i32* %4
%23 = shl i32 %22, 1
store i32 %23, i32* %4
br label %24
24: ; preds = %17, %14
%25 = load i32, i32* %3
%26 = call i32 @liic_delay_(i32 %25)
br label %27
27: ; preds = %31, %24
%28 = load i32, i32* %3
%29 = call i64 @liic_scl_(i32 %28, i32 1)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %27
br label %27
32: ; preds = %27
%33 = load i32, i32* %3
%34 = call i32 @liic_delay_(i32 %33)
br label %35
35: ; preds = %32
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %6
38: ; preds = %6
%39 = load i32, i32* %3
%40 = call i32 @liic_sda_(i32 %39, i32 1)
ret i32 %40
}

LLVM IR (-O2):
define i32 @send(i32 %0, i32 %1) {
br label %5
3: ; preds = %22
%4 = tail call i32 @liic_sda_(i32 %0, i32 1)
ret i32 %4
5: ; preds = %2, %22
%6 = phi i32 [ 0, %2 ], [ %24, %22 ]
%7 = phi i32 [ %1, %2 ], [ %17, %22 ]
%8 = tail call i64 @liic_scl_(i32 %0, i32 0)
%9 = icmp eq i32 %6, 8
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = tail call i32 @liic_sda_(i32 %0, i32 1)
br label %16
12: ; preds = %5
%13 = and i32 %7, 128
%14 = tail call i32 @liic_sda_(i32 %0, i32 %13)
%15 = shl i32 %7, 1
br label %16
16: ; preds = %12, %10
%17 = phi i32 [ %7, %10 ], [ %15, %12 ]
%18 = tail call i32 @liic_delay_(i32 %0)
br label %19
19: ; preds = %19, %16
%20 = tail call i64 @liic_scl_(i32 %0, i32 1)
%21 = icmp eq i64 %20, 0
br i1 %21, label %19, label %22
22: ; preds = %19
%23 = tail call i32 @liic_delay_(i32 %0)
%24 = add nuw nsw i32 %6, 1
%25 = icmp eq i32 %24, 9
br i1 %25, label %3, label %5
}