#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*/ gpio_i2c1();
int /*<<< orphan*/ gpio_i2c2();
int /*<<< orphan*/ init_i2c_hw(int);
int /*<<< orphan*/ nvic_enable(int);
int /*<<< orphan*/ show16(char *, int);
void test_i2c(int device) {
  nvic_enable(31);
  nvic_enable(32);
  nvic_enable(33);
  nvic_enable(34);
  show16("Testing i2c: ", device);
  if (device == 0) {
    gpio_i2c1();
  } else {
    gpio_i2c2();
  }
  init_i2c_hw(device);
}


x86 assembly (clang, -O0):
<test_i2c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1f,%edi
call   1050 <nvic_enable@plt>
mov    $0x20,%edi
call   1050 <nvic_enable@plt>
mov    $0x21,%edi
call   1050 <nvic_enable@plt>
mov    $0x22,%edi
call   1050 <nvic_enable@plt>
mov    -0x4(%rbp),%esi
lea    0xe73(%rip),%rdi
call   1030 <show16@plt>
cmpl   $0x0,-0x4(%rbp)
jne    11a8 <test_i2c+0x58>
mov    $0x0,%al
call   1070 <gpio_i2c1@plt>
jmp    11af <test_i2c+0x5f>
mov    $0x0,%al
call   1060 <gpio_i2c2@plt>
mov    -0x4(%rbp),%edi
call   1040 <init_i2c_hw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_i2c>:
push   %rbx
mov    %edi,%ebx
mov    $0x1f,%edi
call   1050 <nvic_enable@plt>
mov    $0x20,%edi
call   1050 <nvic_enable@plt>
mov    $0x21,%edi
call   1050 <nvic_enable@plt>
mov    $0x22,%edi
call   1050 <nvic_enable@plt>
lea    0xe7e(%rip),%rdi
mov    %ebx,%esi
call   1030 <show16@plt>
xor    %eax,%eax
test   %ebx,%ebx
je     1196 <test_i2c+0x46>
call   1060 <gpio_i2c2@plt>
jmp    119b <test_i2c+0x4b>
call   1070 <gpio_i2c1@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <init_i2c_hw@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Testing i2c: \00"
define void @test_i2c(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @nvic_enable(i32 31)
%4 = call i32 @nvic_enable(i32 32)
%5 = call i32 @nvic_enable(i32 33)
%6 = call i32 @nvic_enable(i32 34)
%7 = load i32, i32* %2
%8 = call i32 @show16(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 (...) @gpio_i2c1()
br label %15
13: ; preds = %1
%14 = call i32 (...) @gpio_i2c2()
br label %15
15: ; preds = %13, %11
%16 = load i32, i32* %2
%17 = call i32 @init_i2c_hw(i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Testing i2c: \00"
define void @test_i2c(i32 %0) {
%2 = tail call i32 @nvic_enable(i32 31)
%3 = tail call i32 @nvic_enable(i32 32)
%4 = tail call i32 @nvic_enable(i32 33)
%5 = tail call i32 @nvic_enable(i32 34)
%6 = tail call i32 @show16(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = icmp eq i32 %0, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 (...) @gpio_i2c1()
br label %12
10: ; preds = %1
%11 = tail call i32 (...) @gpio_i2c2()
br label %12
12: ; preds = %10, %8
%13 = tail call i32 @init_i2c_hw(i32 %0)
ret void
}