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


x86 assembly (clang, -O0):
<reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1181 <reset+0x51>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    -0x8(%rbp),%edi
call   1040 <liic_delay_@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    -0x8(%rbp),%edi
call   1040 <liic_delay_@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1142 <reset+0x12>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1050 <liic_sda_@plt>
cmp    $0x0,%rax
jne    11a4 <reset+0x74>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ab <reset+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset>:
push   %rbx
mov    %edi,%ebx
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <liic_scl_@plt>
mov    %ebx,%edi
call   1040 <liic_delay_@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1050 <liic_sda_@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @reset(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 9
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %3
%10 = call i32 @liic_scl_(i32 %9, i32 0)
%11 = load i32, i32* %3
%12 = call i32 @liic_delay_(i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @liic_scl_(i32 %13, i32 1)
%15 = load i32, i32* %3
%16 = call i32 @liic_delay_(i32 %15)
br label %17
17: ; preds = %8
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %5
20: ; preds = %5
%21 = load i32, i32* %3
%22 = call i64 @liic_sda_(i32 %21, i32 1)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 -1, i32* %2
br label %26
25: ; preds = %20
store i32 0, i32* %2
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @reset(i32 %0) {
%2 = tail call i32 @liic_scl_(i32 %0, i32 0)
%3 = tail call i32 @liic_delay_(i32 %0)
%4 = tail call i32 @liic_scl_(i32 %0, i32 1)
%5 = tail call i32 @liic_delay_(i32 %0)
%6 = tail call i32 @liic_scl_(i32 %0, i32 0)
%7 = tail call i32 @liic_delay_(i32 %0)
%8 = tail call i32 @liic_scl_(i32 %0, i32 1)
%9 = tail call i32 @liic_delay_(i32 %0)
%10 = tail call i32 @liic_scl_(i32 %0, i32 0)
%11 = tail call i32 @liic_delay_(i32 %0)
%12 = tail call i32 @liic_scl_(i32 %0, i32 1)
%13 = tail call i32 @liic_delay_(i32 %0)
%14 = tail call i32 @liic_scl_(i32 %0, i32 0)
%15 = tail call i32 @liic_delay_(i32 %0)
%16 = tail call i32 @liic_scl_(i32 %0, i32 1)
%17 = tail call i32 @liic_delay_(i32 %0)
%18 = tail call i32 @liic_scl_(i32 %0, i32 0)
%19 = tail call i32 @liic_delay_(i32 %0)
%20 = tail call i32 @liic_scl_(i32 %0, i32 1)
%21 = tail call i32 @liic_delay_(i32 %0)
%22 = tail call i32 @liic_scl_(i32 %0, i32 0)
%23 = tail call i32 @liic_delay_(i32 %0)
%24 = tail call i32 @liic_scl_(i32 %0, i32 1)
%25 = tail call i32 @liic_delay_(i32 %0)
%26 = tail call i32 @liic_scl_(i32 %0, i32 0)
%27 = tail call i32 @liic_delay_(i32 %0)
%28 = tail call i32 @liic_scl_(i32 %0, i32 1)
%29 = tail call i32 @liic_delay_(i32 %0)
%30 = tail call i32 @liic_scl_(i32 %0, i32 0)
%31 = tail call i32 @liic_delay_(i32 %0)
%32 = tail call i32 @liic_scl_(i32 %0, i32 1)
%33 = tail call i32 @liic_delay_(i32 %0)
%34 = tail call i32 @liic_scl_(i32 %0, i32 0)
%35 = tail call i32 @liic_delay_(i32 %0)
%36 = tail call i32 @liic_scl_(i32 %0, i32 1)
%37 = tail call i32 @liic_delay_(i32 %0)
%38 = tail call i64 @liic_sda_(i32 %0, i32 1)
%39 = icmp eq i64 %38, 0
%40 = sext i1 %39 to i32
ret i32 %40
}