#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 */
typedef int uint8_t;
typedef int uint32_t;
typedef int volatile uint16_t;
typedef int int8_t;

/* Variables and functions */
uint16_t I2C_Send1(int8_t slave, uint8_t data1) {
  while ((*((volatile uint32_t *)0x40021004)) & 0x00000001) {
  };
  (*((volatile uint32_t *)0x40021000)) = (slave << 1) & 0xFE;
  (*((volatile uint32_t *)0x40021000)) &= ~0x01;
  (*((volatile uint32_t *)0x40021008)) = data1 & 0xFF;
  (*((volatile uint32_t *)0x40021004)) =
      (0 | 0x00000004 | 0x00000002 | 0x00000001);
  while ((*((volatile uint32_t *)0x40021004)) & 0x00000001) {
  };
  return ((*((volatile uint32_t *)0x40021004)) &
          (0x00000008 | 0x00000004 | 0x00000002));
}


x86 assembly (clang, -O0):
<I2C_Send1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1122 <I2C_Send1+0x22>
jmp    110a <I2C_Send1+0xa>
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
and    $0xfe,%ecx
mov    $0x40021000,%eax
mov    %ecx,(%rax)
mov    $0x40021000,%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    $0x40021000,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
mov    $0x40021008,%eax
mov    %ecx,(%rax)
mov    $0x40021004,%eax
movl   $0x7,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1179 <I2C_Send1+0x79>
jmp    1161 <I2C_Send1+0x61>
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0xe,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2C_Send1>:
mov    0x40021004,%eax
test   $0x1,%al
jne    1100 <I2C_Send1>
add    %edi,%edi
movzbl %dil,%eax
mov    %eax,0x40021000
andl   $0xfffffffe,0x40021000
fe
movzbl %sil,%eax
mov    %eax,0x40021008
movl   $0x7,0x40021004
cs nopw 0x0(%rax,%rax,1)
mov    0x40021004,%eax
test   $0x1,%al
jne    1140 <I2C_Send1+0x40>
mov    0x40021004,%eax
and    $0xe,%eax
ret

LLVM IR (-O0):
define i32 @I2C_Send1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %9, %2
%6 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%7 = and i32 %6, 1
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load i32, i32* %3
%12 = shl i32 %11, 1
%13 = and i32 %12, 254
store volatile i32 %13, i32* inttoptr (i64 1073876992 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 1073876992 to i32*)
%15 = and i32 %14, -2
store volatile i32 %15, i32* inttoptr (i64 1073876992 to i32*)
%16 = load i32, i32* %4
%17 = and i32 %16, 255
store volatile i32 %17, i32* inttoptr (i64 1073877000 to i32*)
store volatile i32 7, i32* inttoptr (i64 1073876996 to i32*)
br label %18
18: ; preds = %22, %10
%19 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%20 = and i32 %19, 1
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
br label %18
23: ; preds = %18
%24 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%25 = and i32 %24, 14
ret i32 %25
}

LLVM IR (-O2):
define i32 @I2C_Send1(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = shl i32 %0, 1
%9 = and i32 %8, 254
store volatile i32 %9, i32* inttoptr (i64 1073876992 to i32*)
%10 = load volatile i32, i32* inttoptr (i64 1073876992 to i32*)
%11 = and i32 %10, -2
store volatile i32 %11, i32* inttoptr (i64 1073876992 to i32*)
%12 = and i32 %1, 255
store volatile i32 %12, i32* inttoptr (i64 1073877000 to i32*)
store volatile i32 7, i32* inttoptr (i64 1073876996 to i32*)
br label %13
13: ; preds = %13, %7
%14 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%15 = and i32 %14, 1
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %13
17: ; preds = %13
%18 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%19 = and i32 %18, 14
ret i32 %19
}