#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_Send3(int8_t slave, uint8_t data1, uint8_t data2, uint8_t data3) {
  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 | 0x00000002 | 0x00000001);
  while ((*((volatile uint32_t *)0x40021004)) & 0x00000001) {
  };
  if (((*((volatile uint32_t *)0x40021004)) &
       (0x00000008 | 0x00000004 | 0x00000002)) != 0) {
    (*((volatile uint32_t *)0x40021004)) = (0 | 0x00000004);
    return ((*((volatile uint32_t *)0x40021004)) &
            (0x00000008 | 0x00000004 | 0x00000002));
  }
  (*((volatile uint32_t *)0x40021008)) = data2 & 0xFF;
  (*((volatile uint32_t *)0x40021004)) = (0 | 0x00000001);
  while ((*((volatile uint32_t *)0x40021004)) & 0x00000001) {
  };
  if (((*((volatile uint32_t *)0x40021004)) &
       (0x00000008 | 0x00000004 | 0x00000002)) != 0) {
    (*((volatile uint32_t *)0x40021004)) = (0 | 0x00000004);
    return ((*((volatile uint32_t *)0x40021004)) &
            (0x00000008 | 0x00000004 | 0x00000002));
  }
  (*((volatile uint32_t *)0x40021008)) = data3 & 0xFF;
  (*((volatile uint32_t *)0x40021004)) = (0 | 0x00000004 | 0x00000001);
  while ((*((volatile uint32_t *)0x40021004)) & 0x00000001) {
  };
  return ((*((volatile uint32_t *)0x40021004)) &
          (0x00000008 | 0x00000004 | 0x00000002));
}


x86 assembly (clang, -O0):
<I2C_Send3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1128 <I2C_Send3+0x28>
jmp    1110 <I2C_Send3+0x10>
mov    -0x8(%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    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    $0x40021008,%eax
mov    %ecx,(%rax)
mov    $0x40021004,%eax
movl   $0x3,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     117f <I2C_Send3+0x7f>
jmp    1167 <I2C_Send3+0x67>
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0xe,%eax
cmp    $0x0,%eax
je     11af <I2C_Send3+0xaf>
mov    $0x40021004,%eax
movl   $0x4,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0xe,%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <I2C_Send3+0x152>
mov    -0x10(%rbp),%ecx
and    $0xff,%ecx
mov    $0x40021008,%eax
mov    %ecx,(%rax)
mov    $0x40021004,%eax
movl   $0x1,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11e2 <I2C_Send3+0xe2>
jmp    11ca <I2C_Send3+0xca>
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0xe,%eax
cmp    $0x0,%eax
je     1212 <I2C_Send3+0x112>
mov    $0x40021004,%eax
movl   $0x4,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0xe,%eax
mov    %eax,-0x4(%rbp)
jmp    1252 <I2C_Send3+0x152>
mov    -0x14(%rbp),%ecx
and    $0xff,%ecx
mov    $0x40021008,%eax
mov    %ecx,(%rax)
mov    $0x40021004,%eax
movl   $0x5,(%rax)
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1245 <I2C_Send3+0x145>
jmp    122d <I2C_Send3+0x12d>
mov    $0x40021004,%eax
mov    (%rax),%eax
and    $0xe,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2C_Send3>:
mov    0x40021004,%eax
test   $0x1,%al
jne    1100 <I2C_Send3>
add    %edi,%edi
movzbl %dil,%eax
mov    %eax,0x40021000
andl   $0xfffffffe,0x40021000
fe
movzbl %sil,%eax
mov    %eax,0x40021008
movl   $0x3,0x40021004
cs nopw 0x0(%rax,%rax,1)
mov    0x40021004,%eax
test   $0x1,%al
jne    1140 <I2C_Send3+0x40>
testl  $0xe,0x40021004
jne    1188 <I2C_Send3+0x88>
movzbl %dl,%eax
mov    %eax,0x40021008
movl   $0x1,0x40021004
nopl   (%rax)
mov    0x40021004,%eax
test   $0x1,%al
jne    1170 <I2C_Send3+0x70>
testl  $0xe,0x40021004
je     119e <I2C_Send3+0x9e>
movl   $0x4,0x40021004
mov    0x40021004,%eax
and    $0xe,%eax
ret
movzbl %cl,%eax
mov    %eax,0x40021008
movl   $0x5,0x40021004
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
testl  $0x1,0x40021004
jne    11c0 <I2C_Send3+0xc0>
jmp    1193 <I2C_Send3+0x93>

LLVM IR (-O0):
define i32 @I2C_Send3(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
br label %10
10: ; preds = %14, %4
%11 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
br label %10
15: ; preds = %10
%16 = load i32, i32* %6
%17 = shl i32 %16, 1
%18 = and i32 %17, 254
store volatile i32 %18, i32* inttoptr (i64 1073876992 to i32*)
%19 = load volatile i32, i32* inttoptr (i64 1073876992 to i32*)
%20 = and i32 %19, -2
store volatile i32 %20, i32* inttoptr (i64 1073876992 to i32*)
%21 = load i32, i32* %7
%22 = and i32 %21, 255
store volatile i32 %22, i32* inttoptr (i64 1073877000 to i32*)
store volatile i32 3, i32* inttoptr (i64 1073876996 to i32*)
br label %23
23: ; preds = %27, %15
%24 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%25 = and i32 %24, 1
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
br label %23
28: ; preds = %23
%29 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%30 = and i32 %29, 14
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %28
store volatile i32 4, i32* inttoptr (i64 1073876996 to i32*)
%33 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%34 = and i32 %33, 14
store i32 %34, i32* %5
br label %61
35: ; preds = %28
%36 = load i32, i32* %8
%37 = and i32 %36, 255
store volatile i32 %37, i32* inttoptr (i64 1073877000 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073876996 to i32*)
br label %38
38: ; preds = %42, %35
%39 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%40 = and i32 %39, 1
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
br label %38
43: ; preds = %38
%44 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%45 = and i32 %44, 14
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
store volatile i32 4, i32* inttoptr (i64 1073876996 to i32*)
%48 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%49 = and i32 %48, 14
store i32 %49, i32* %5
br label %61
50: ; preds = %43
%51 = load i32, i32* %9
%52 = and i32 %51, 255
store volatile i32 %52, i32* inttoptr (i64 1073877000 to i32*)
store volatile i32 5, i32* inttoptr (i64 1073876996 to i32*)
br label %53
53: ; preds = %57, %50
%54 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%55 = and i32 %54, 1
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %53
br label %53
58: ; preds = %53
%59 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%60 = and i32 %59, 14
store i32 %60, i32* %5
br label %61
61: ; preds = %58, %47, %32
%62 = load i32, i32* %5
ret i32 %62
}

LLVM IR (-O2):
define i32 @I2C_Send3(i32 %0, i32 %1, i32 %2, i32 %3) {
br label %5
5: ; preds = %5, %4
%6 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%7 = and i32 %6, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5
%10 = shl i32 %0, 1
%11 = and i32 %10, 254
store volatile i32 %11, i32* inttoptr (i64 1073876992 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 1073876992 to i32*)
%13 = and i32 %12, -2
store volatile i32 %13, i32* inttoptr (i64 1073876992 to i32*)
%14 = and i32 %1, 255
store volatile i32 %14, i32* inttoptr (i64 1073877000 to i32*)
store volatile i32 3, i32* inttoptr (i64 1073876996 to i32*)
br label %15
15: ; preds = %15, %9
%16 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%17 = and i32 %16, 1
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %15
19: ; preds = %15
%20 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%21 = and i32 %20, 14
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %39
23: ; preds = %19
%24 = and i32 %2, 255
store volatile i32 %24, i32* inttoptr (i64 1073877000 to i32*)
store volatile i32 1, i32* inttoptr (i64 1073876996 to i32*)
br label %25
25: ; preds = %25, %23
%26 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%27 = and i32 %26, 1
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %25
29: ; preds = %25
%30 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%31 = and i32 %30, 14
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = and i32 %3, 255
store volatile i32 %34, i32* inttoptr (i64 1073877000 to i32*)
store volatile i32 5, i32* inttoptr (i64 1073876996 to i32*)
br label %35
35: ; preds = %35, %33
%36 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%37 = and i32 %36, 1
%38 = icmp eq i32 %37, 0
br i1 %38, label %40, label %35
39: ; preds = %29, %19
store volatile i32 4, i32* inttoptr (i64 1073876996 to i32*)
br label %40
40: ; preds = %35, %39
%41 = load volatile i32, i32* inttoptr (i64 1073876996 to i32*)
%42 = and i32 %41, 14
ret i32 %42
}