#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*/ print_err(char *);
int /*<<< orphan*/ print_err_hex8(unsigned char);
void smbus_print_error(unsigned char host_status_register) {
  print_err("smbus_error: ");
  print_err_hex8(host_status_register);
  print_err("\n");
  if (host_status_register & (1 << 4)) {
    print_err("Interrup/SMI# was Failed Bus Transaction\n");
  }
  if (host_status_register & (1 << 3)) {
    print_err("Bus Error\n");
  }
  if (host_status_register & (1 << 2)) {
    print_err("Device Error\n");
  }
  if (host_status_register & (1 << 1)) {
    print_err("Interrupt/SMI# was Successful Completion\n");
  }
  if (host_status_register & (1 << 0)) {
    print_err("Host Busy\n");
  }
}


x86 assembly (clang, -O0):
<smbus_print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xecb(%rip),%rdi
call   1030 <print_err@plt>
movzbl -0x1(%rbp),%edi
call   1040 <print_err_hex8@plt>
lea    0xeec(%rip),%rdi
call   1030 <print_err@plt>
movzbl -0x1(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     116b <smbus_print_error+0x4b>
lea    0xea8(%rip),%rdi
call   1030 <print_err@plt>
movzbl -0x1(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1187 <smbus_print_error+0x67>
lea    0xeb6(%rip),%rdi
call   1030 <print_err@plt>
movzbl -0x1(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11a3 <smbus_print_error+0x83>
lea    0xea5(%rip),%rdi
call   1030 <print_err@plt>
movzbl -0x1(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11bf <smbus_print_error+0x9f>
lea    0xe97(%rip),%rdi
call   1030 <print_err@plt>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11db <smbus_print_error+0xbb>
lea    0xea5(%rip),%rdi
call   1030 <print_err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smbus_print_error>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <print_err@plt>
mov    %ebx,%edi
call   1040 <print_err_hex8@plt>
lea    0xef9(%rip),%rdi
call   1030 <print_err@plt>
test   $0x10,%bl
jne    115d <smbus_print_error+0x3d>
test   $0x8,%bl
jne    116e <smbus_print_error+0x4e>
test   $0x4,%bl
jne    117f <smbus_print_error+0x5f>
test   $0x2,%bl
jne    1190 <smbus_print_error+0x70>
test   $0x1,%bl
jne    11a1 <smbus_print_error+0x81>
pop    %rbx
ret
lea    0xeaa(%rip),%rdi
call   1030 <print_err@plt>
test   $0x8,%bl
je     114c <smbus_print_error+0x2c>
lea    0xec3(%rip),%rdi
call   1030 <print_err@plt>
test   $0x4,%bl
je     1151 <smbus_print_error+0x31>
lea    0xebd(%rip),%rdi
call   1030 <print_err@plt>
test   $0x2,%bl
je     1156 <smbus_print_error+0x36>
lea    0xeba(%rip),%rdi
call   1030 <print_err@plt>
test   $0x1,%bl
je     115b <smbus_print_error+0x3b>
lea    0xed3(%rip),%rdi
pop    %rbx
jmp    1030 <print_err@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"smbus_error: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [42 x i8] c"Interrup/SMI# was Failed Bus Transaction\0A\00"
@.str.3 = [11 x i8] c"Bus Error\0A\00"
@.str.4 = [14 x i8] c"Device Error\0A\00"
@.str.5 = [42 x i8] c"Interrupt/SMI# was Successful Completion\0A\00"
@.str.6 = [11 x i8] c"Host Busy\0A\00"
define void @smbus_print_error(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @print_err(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* %2
%5 = call i32 @print_err_hex8(i8 zeroext %4)
%6 = call i32 @print_err(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = and i32 %8, 16
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @print_err(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %1
%14 = load i8, i8* %2
%15 = zext i8 %14 to i32
%16 = and i32 %15, 8
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %13
%19 = call i32 @print_err(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %13
%21 = load i8, i8* %2
%22 = zext i8 %21 to i32
%23 = and i32 %22, 4
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 @print_err(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %20
%28 = load i8, i8* %2
%29 = zext i8 %28 to i32
%30 = and i32 %29, 2
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = call i32 @print_err(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
br label %34
34: ; preds = %32, %27
%35 = load i8, i8* %2
%36 = zext i8 %35 to i32
%37 = and i32 %36, 1
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 @print_err(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %39, %34
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"smbus_error: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [42 x i8] c"Interrup/SMI# was Failed Bus Transaction\0A\00"
@.str.3 = [11 x i8] c"Bus Error\0A\00"
@.str.4 = [14 x i8] c"Device Error\0A\00"
@.str.5 = [42 x i8] c"Interrupt/SMI# was Successful Completion\0A\00"
@.str.6 = [11 x i8] c"Host Busy\0A\00"
define void @smbus_print_error(i8 zeroext %0) {
%2 = tail call i32 @print_err(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @print_err_hex8(i8 zeroext %0)
%4 = tail call i32 @print_err(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = zext i8 %0 to i32
%6 = and i32 %5, 16
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @print_err(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = and i32 %5, 8
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @print_err(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = and i32 %5, 4
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @print_err(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = and i32 %5, 2
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = tail call i32 @print_err(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
%26 = and i32 %5, 1
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 @print_err(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %30
30: ; preds = %28, %25
ret void
}