#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*/ TwDelay(int);
int TwPut(unsigned char octet) {
  int i;
  for (i = 0x80; i; i >>= 1) {
    if (octet & i) {
      (*((volatile unsigned int *)((0xFFFF0000 + 0x14))) = ((1 << 16)));
    } else {
      (*((volatile unsigned int *)((0xFFFF0000 + 0x10))) = ((1 << 16)));
    }
    TwDelay(8);
    (*((volatile unsigned int *)((0xFFFF0000 + 0x14))) = ((1 << 17)));
    TwDelay(2 * 8);
    (*((volatile unsigned int *)((0xFFFF0000 + 0x10))) = ((1 << 17)));
  }
  (*((volatile unsigned int *)((0xFFFF0000 + 0x14))) = ((1 << 16)));
  (*((volatile unsigned int *)((0xFFFF0000 + 0x14))) = ((1 << 17)));
  TwDelay(2 * 8);
  if (((*((volatile unsigned int *)((0xFFFF0000 + 0x3C)))) & (1 << 16))) {
    i = -1;
  } else {
    i = 0;
  }
  (*((volatile unsigned int *)((0xFFFF0000 + 0x10))) = ((1 << 17)));
  return i;
}


x86 assembly (clang, -O0):
<TwPut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x80,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1192 <TwPut+0x82>
movzbl -0x1(%rbp),%eax
and    -0x8(%rbp),%eax
cmp    $0x0,%eax
je     114f <TwPut+0x3f>
mov    $0xffff0014,%eax
movl   $0x10000,(%rax)
jmp    115a <TwPut+0x4a>
mov    $0xffff0010,%eax
movl   $0x10000,(%rax)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
mov    $0xffff0014,%eax
movl   $0x20000,(%rax)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
mov    $0xffff0010,%eax
movl   $0x20000,(%rax)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1125 <TwPut+0x15>
mov    $0xffff0014,%eax
movl   $0x10000,(%rax)
mov    $0xffff0014,%eax
movl   $0x20000,(%rax)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
mov    $0xffff003c,%eax
mov    (%rax),%eax
and    $0x10000,%eax
cmp    $0x0,%eax
je     11d3 <TwPut+0xc3>
movl   $0xffffffff,-0x8(%rbp)
jmp    11da <TwPut+0xca>
movl   $0x0,-0x8(%rbp)
mov    $0xffff0010,%eax
movl   $0x20000,(%rax)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TwPut>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0xffff0014,%ebx
test   $0x80,%bpl
jne    1129 <TwPut+0x19>
movl   $0x10000,-0x4(%rbx)
jmp    112f <TwPut+0x1f>
movl   $0x10000,(%rbx)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,-0x4(%rbx)
test   $0x40,%bpl
jne    115f <TwPut+0x4f>
movl   $0x10000,-0x4(%rbx)
jmp    1165 <TwPut+0x55>
movl   $0x10000,(%rbx)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,-0x4(%rbx)
test   $0x20,%bpl
jne    1195 <TwPut+0x85>
movl   $0x10000,-0x4(%rbx)
jmp    119b <TwPut+0x8b>
movl   $0x10000,(%rbx)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,-0x4(%rbx)
test   $0x10,%bpl
jne    11cb <TwPut+0xbb>
movl   $0x10000,-0x4(%rbx)
jmp    11d1 <TwPut+0xc1>
movl   $0x10000,(%rbx)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,-0x4(%rbx)
test   $0x8,%bpl
jne    1201 <TwPut+0xf1>
movl   $0x10000,-0x4(%rbx)
jmp    1207 <TwPut+0xf7>
movl   $0x10000,(%rbx)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,-0x4(%rbx)
test   $0x4,%bpl
jne    1237 <TwPut+0x127>
movl   $0x10000,-0x4(%rbx)
jmp    123d <TwPut+0x12d>
movl   $0x10000,(%rbx)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,-0x4(%rbx)
test   $0x2,%bpl
jne    126d <TwPut+0x15d>
movl   $0x10000,-0x4(%rbx)
jmp    1273 <TwPut+0x163>
movl   $0x10000,(%rbx)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,-0x4(%rbx)
test   $0x1,%bpl
jne    12a3 <TwPut+0x193>
movl   $0x10000,-0x4(%rbx)
jmp    12a9 <TwPut+0x199>
movl   $0x10000,(%rbx)
mov    $0x8,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
movl   $0x20000,-0x4(%rbx)
movl   $0x10000,(%rbx)
movl   $0x20000,(%rbx)
mov    $0x10,%edi
call   1030 <TwDelay@plt>
mov    0x28(%rbx),%eax
shl    $0xf,%eax
sar    $0x1f,%eax
movl   $0x20000,-0x4(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @TwPut(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 128, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = load i32, i32* %3
%11 = and i32 %9, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %7
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %15
14: ; preds = %7
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %15
15: ; preds = %14, %13
%16 = call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%17 = call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
br label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = ashr i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%22 = call i32 @TwDelay(i32 16)
%23 = load volatile i32, i32* inttoptr (i64 4294901820 to i32*)
%24 = and i32 %23, 65536
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 -1, i32* %3
br label %28
27: ; preds = %21
store i32 0, i32* %3
br label %28
28: ; preds = %27, %26
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @TwPut(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %1
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %7
6: ; preds = %1
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %7
7: ; preds = %6, %5
%8 = tail call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%9 = tail call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
%10 = and i32 %2, 64
%11 = icmp eq i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %7
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %14
13: ; preds = %7
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %14
14: ; preds = %13, %12
%15 = tail call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%16 = tail call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
%17 = and i32 %2, 32
%18 = icmp eq i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %14
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %21
20: ; preds = %14
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %21
21: ; preds = %20, %19
%22 = tail call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%23 = tail call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
%24 = and i32 %2, 16
%25 = icmp eq i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %21
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %28
27: ; preds = %21
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %28
28: ; preds = %27, %26
%29 = tail call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%30 = tail call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
%31 = and i32 %2, 8
%32 = icmp eq i32 %31, 0
br i1 %32, label %34, label %33
33: ; preds = %28
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %35
34: ; preds = %28
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %35
35: ; preds = %34, %33
%36 = tail call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%37 = tail call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
%38 = and i32 %2, 4
%39 = icmp eq i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %35
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %42
41: ; preds = %35
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %42
42: ; preds = %41, %40
%43 = tail call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%44 = tail call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
%45 = and i32 %2, 2
%46 = icmp eq i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %42
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %49
48: ; preds = %42
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %49
49: ; preds = %48, %47
%50 = tail call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%51 = tail call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
%52 = and i32 %2, 1
%53 = icmp eq i32 %52, 0
br i1 %53, label %55, label %54
54: ; preds = %49
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
br label %56
55: ; preds = %49
store volatile i32 65536, i32* inttoptr (i64 4294901776 to i32*)
br label %56
56: ; preds = %55, %54
%57 = tail call i32 @TwDelay(i32 8)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%58 = tail call i32 @TwDelay(i32 16)
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
store volatile i32 65536, i32* inttoptr (i64 4294901780 to i32*)
store volatile i32 131072, i32* inttoptr (i64 4294901780 to i32*)
%59 = tail call i32 @TwDelay(i32 16)
%60 = load volatile i32, i32* inttoptr (i64 4294901820 to i32*)
%61 = shl i32 %60, 15
%62 = ashr i32 %61, 31
store volatile i32 131072, i32* inttoptr (i64 4294901776 to i32*)
ret i32 %62
}