#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*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
void print_data(unsigned char *pbuf, int branch_num) {
  unsigned char buf_lbl = pbuf[7] & 0x01U;
  unsigned char buf_status = pbuf[7] >> 1 & 0x07U;
  unsigned char buf_ov = pbuf[8];
  char ch_buf_lbl[6];
  switch (buf_lbl) {
  case 0:
    strcpy(ch_buf_lbl, "Left ");
    break;
  case 1:
    strcpy(ch_buf_lbl, "Right");
    break;
  }
  char ch_status[9];
  switch (buf_status) {
  case 0:
    strcpy(ch_status, "Empty");
    break;
  case 1:
    break;
  case 2:
    strcpy(ch_status, "Write");
    break;
  case 3:
    strcpy(ch_status, "Full    ");
    break;
  case 4:
    strcpy(ch_status, "Overflow");
    break;
  default:
    break;
  }
  printf("Branch%d Data Right. Buf %s. Status: %s. OV: %d. \n", branch_num,
         ch_buf_lbl, ch_status, buf_ov);
  printf("\033[40;34mbn\033[0m: %d, ", pbuf[1]);
  printf("\033[40;34mfn\033[0m: %d, ", pbuf[4] << 8 | pbuf[5]);
  printf("\033[40;34mwait\033[0m: %d\n", pbuf[6]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x7(%rax),%al
and    $0x1,%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
mov    0x7(%rax),%al
shr    %al
and    $0x7,%al
mov    %al,-0xe(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%al
mov    %al,-0xf(%rbp)
movzbl -0xd(%rbp),%eax
mov    %eax,-0x24(%rbp)
test   %eax,%eax
je     1178 <print_data+0x58>
jmp    1167 <print_data+0x47>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
je     118d <print_data+0x6d>
jmp    119d <print_data+0x7d>
lea    -0x15(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcpy@plt>
jmp    119d <print_data+0x7d>
lea    -0x15(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcpy@plt>
movzbl -0xe(%rbp),%eax
mov    %rax,-0x30(%rbp)
sub    $0x4,%rax
ja     121c <print_data+0xfc>
mov    -0x30(%rbp),%rax
lea    0xe46(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x1e(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1221 <print_data+0x101>
jmp    1221 <print_data+0x101>
lea    -0x1e(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1221 <print_data+0x101>
lea    -0x1e(%rbp),%rdi
lea    0xe2f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1221 <print_data+0x101>
lea    -0x1e(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1221 <print_data+0x101>
jmp    1221 <print_data+0x101>
mov    -0xc(%rbp),%esi
lea    -0x15(%rbp),%rdx
lea    -0x1e(%rbp),%rcx
movzbl -0xf(%rbp),%r8d
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%esi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x4(%rax),%esi
shl    $0x8,%esi
mov    -0x8(%rbp),%rax
movzbl 0x5(%rax),%eax
or     %eax,%esi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%esi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_data>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
movzbl 0x7(%rdi),%eax
mov    %eax,%ebp
shr    %ebp
and    $0x7,%ebp
movzbl 0x8(%rdi),%r15d
test   $0x1,%al
lea    0xea7(%rip),%rax
lea    0xea6(%rip),%rsi
cmove  %rax,%rsi
lea    0x9(%rsp),%rdi
call   1040 <strcpy@plt>
cmp    $0x4,%bpl
ja     119a <print_data+0x6a>
movzbl %bpl,%eax
mov    $0x1d,%ecx
bt     %eax,%ecx
jae    119a <print_data+0x6a>
lea    0xf17(%rip),%rax
movslq (%rax,%rbp,4),%rsi
add    %rax,%rsi
lea    0xf(%rsp),%rdi
call   1040 <strcpy@plt>
lea    0xe89(%rip),%rdi
lea    0x9(%rsp),%rdx
lea    0xf(%rsp),%rcx
mov    %r14d,%esi
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x1(%rbx),%esi
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzwl 0x4(%rbx),%esi
shl    $0x10,%esi
bswap  %esi
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x6(%rbx),%esi
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Left \00"
@.str.1 = [6 x i8] c"Right\00"
@.str.2 = [6 x i8] c"Empty\00"
@.str.3 = [6 x i8] c"Write\00"
@.str.4 = [9 x i8] c"Full \00"
@.str.5 = [9 x i8] c"Overflow\00"
@.str.6 = [51 x i8] c"Branch%d Data Right. Buf %s. Status: %s. OV: %d. \0A\00"
@.str.7 = [21 x i8] c"\1B[40;34mbn\1B[0m: %d, \00"
@.str.8 = [21 x i8] c"\1B[40;34mfn\1B[0m: %d, \00"
@.str.9 = [22 x i8] c"\1B[40;34mwait\1B[0m: %d\0A\00"
@.str.10 = [2 x i8] c"\0A\00"
define void @print_data(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca [6 x i8]
%9 = alloca [9 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 7
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = and i32 %13, 1
%15 = trunc i32 %14 to i8
store i8 %15, i8* %5
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 7
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = ashr i32 %19, 1
%21 = and i32 %20, 7
%22 = trunc i32 %21 to i8
store i8 %22, i8* %6
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 8
%25 = load i8, i8* %24
store i8 %25, i8* %7
%26 = load i8, i8* %5
%27 = zext i8 %26 to i32
switch i32 %27, label %34 [
i32 0, label %28
i32 1, label %31
]
28: ; preds = %2
%29 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%30 = call i32 @strcpy(i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %34
31: ; preds = %2
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %2, %31, %28
%35 = load i8, i8* %6
%36 = zext i8 %35 to i32
switch i32 %36, label %50 [
i32 0, label %37
i32 1, label %40
i32 2, label %41
i32 3, label %44
i32 4, label %47
]
37: ; preds = %34
%38 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %51
40: ; preds = %34
br label %51
41: ; preds = %34
%42 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%43 = call i32 @strcpy(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %51
44: ; preds = %34
%45 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%46 = call i32 @strcpy(i8* %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %51
47: ; preds = %34
%48 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%49 = call i32 @strcpy(i8* %48, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %51
50: ; preds = %34
br label %51
51: ; preds = %50, %47, %44, %41, %40, %37
%52 = load i32, i32* %4
%53 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%54 = getelementptr inbounds [9 x i8], [9 x i8]* %9, i64 0, i64 0
%55 = load i8, i8* %7
%56 = zext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 %52, i8* %53, i8* %54, i32 %56)
%58 = load i8*, i8** %3
%59 = getelementptr inbounds i8, i8* %58, i64 1
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %61)
%63 = load i8*, i8** %3
%64 = getelementptr inbounds i8, i8* %63, i64 4
%65 = load i8, i8* %64
%66 = zext i8 %65 to i32
%67 = shl i32 %66, 8
%68 = load i8*, i8** %3
%69 = getelementptr inbounds i8, i8* %68, i64 5
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = or i32 %67, %71
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 %72)
%74 = load i8*, i8** %3
%75 = getelementptr inbounds i8, i8* %74, i64 6
%76 = load i8, i8* %75
%77 = zext i8 %76 to i32
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %77)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Left \00"
@.str.1 = [6 x i8] c"Right\00"
@.str.2 = [6 x i8] c"Empty\00"
@.str.3 = [6 x i8] c"Write\00"
@.str.4 = [9 x i8] c"Full \00"
@.str.5 = [9 x i8] c"Overflow\00"
@.str.6 = [51 x i8] c"Branch%d Data Right. Buf %s. Status: %s. OV: %d. \0A\00"
@.str.7 = [21 x i8] c"\1B[40;34mbn\1B[0m: %d, \00"
@.str.8 = [21 x i8] c"\1B[40;34mfn\1B[0m: %d, \00"
@.str.9 = [22 x i8] c"\1B[40;34mwait\1B[0m: %d\0A\00"
@reltable.print_data = [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([5 x i32]* @reltable.print_data to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([5 x i32]* @reltable.print_data to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([5 x i32]* @reltable.print_data to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.4 to i64), i64 ptrtoint ([5 x i32]* @reltable.print_data to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.5 to i64), i64 ptrtoint ([5 x i32]* @reltable.print_data to i64)) to i32)]
define void @print_data(i8* nocapture %0, i32 %1) {
%3 = alloca [6 x i8]
%4 = alloca [9 x i8]
%5 = getelementptr inbounds i8, i8* %0, i64 7
%6 = load i8, i8* %5
%7 = lshr i8 %6, 1
%8 = and i8 %7, 7
%9 = getelementptr inbounds i8, i8* %0, i64 8
%10 = load i8, i8* %9
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%12 = and i8 %6, 1
%13 = icmp eq i8 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%15 = call i32 @strcpy(i8* %11, i8* %14)
%16 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%17 = icmp ult i8 %8, 5
br i1 %17, label %18, label %27
18: ; preds = %2
%19 = lshr i8 29, %8
%20 = and i8 %19, 1
%21 = icmp eq i8 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = zext i8 %8 to i64
%24 = shl i64 %23, 2
%25 = call i8* @llvm.load.relative.i64(i8* bitcast ([5 x i32]* @reltable.print_data to i8*), i64 %24)
%26 = call i32 @strcpy(i8* %16, i8* %25)
br label %27
27: ; preds = %18, %2, %22
%28 = zext i8 %10 to i32
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 %1, i8* %11, i8* %16, i32 %28)
%30 = getelementptr inbounds i8, i8* %0, i64 1
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds i8, i8* %0, i64 4
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = shl nuw nsw i32 %36, 8
%38 = getelementptr inbounds i8, i8* %0, i64 5
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = or i32 %37, %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds i8, i8* %0, i64 6
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %45)
%47 = call i32 @putchar(i32 10)
ret void
}