#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 *, ...);
void decode_ad9520_status(unsigned char status) {
  printf("\nAD9520 status register decode value %02x:\n", status);
  if (status & 0x40)
    printf(" VCO cal finished\n");
  else
    printf(" VCO cal unfinished\n");
  if (status & 0x20)
    printf(" holdover active\n");
  else
    printf(" holdover not active\n");
  if (status & 0x10)
    printf(" REF2 selected\n");
  else
    printf(" REF1 selected\n");
  if (status & 0x08)
    printf(" VCO freq > thresh\n");
  else
    printf(" VCO freq < thrtesh\n");
  if (status & 0x04)
    printf(" REF2 freq > thresh\n");
  else
    printf(" REF2 freq < thrtesh\n");
  if (status & 0x02)
    printf(" REF1 freq > thresh\n");
  else
    printf(" REF1 freq < thrtesh\n");
  if (status & 0x01)
    printf(" PLL locked\n");
  else
    printf(" PLL unlocked\n");
}


x86 assembly (clang, -O0):
<decode_ad9520_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1153 <decode_ad9520_status+0x43>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1161 <decode_ad9520_status+0x51>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1184 <decode_ad9520_status+0x74>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1192 <decode_ad9520_status+0x82>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11b5 <decode_ad9520_status+0xa5>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c3 <decode_ad9520_status+0xb3>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     11e6 <decode_ad9520_status+0xd6>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f4 <decode_ad9520_status+0xe4>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1217 <decode_ad9520_status+0x107>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <decode_ad9520_status+0x115>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1248 <decode_ad9520_status+0x138>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1256 <decode_ad9520_status+0x146>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1279 <decode_ad9520_status+0x169>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1287 <decode_ad9520_status+0x177>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_ad9520_status>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x40,%bl
lea    0xeef(%rip),%rax
lea    0xfd3(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
test   $0x20,%bl
lea    0xee9(%rip),%rax
lea    0xfa8(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
test   $0x10,%bl
lea    0xee4(%rip),%rax
lea    0xf7f(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
test   $0x8,%bl
lea    0xed9(%rip),%rax
lea    0xf52(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
test   $0x4,%bl
lea    0xed3(%rip),%rax
lea    0xf24(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
test   $0x2,%bl
lea    0xece(%rip),%rax
lea    0xef6(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
test   $0x1,%bl
lea    0xec9(%rip),%rax
lea    0xed0(%rip),%rdi
cmove  %rax,%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"\0AAD9520 status register decode value %02x:\0A\00"
@.str.1 = [19 x i8] c" VCO cal finished\0A\00"
@.str.2 = [21 x i8] c" VCO cal unfinished\0A\00"
@.str.3 = [18 x i8] c" holdover active\0A\00"
@.str.4 = [22 x i8] c" holdover not active\0A\00"
@.str.5 = [16 x i8] c" REF2 selected\0A\00"
@.str.6 = [16 x i8] c" REF1 selected\0A\00"
@.str.7 = [20 x i8] c" VCO freq > thresh\0A\00"
@.str.8 = [21 x i8] c" VCO freq < thrtesh\0A\00"
@.str.9 = [21 x i8] c" REF2 freq > thresh\0A\00"
@.str.10 = [22 x i8] c" REF2 freq < thrtesh\0A\00"
@.str.11 = [21 x i8] c" REF1 freq > thresh\0A\00"
@.str.12 = [22 x i8] c" REF1 freq < thrtesh\0A\00"
@.str.13 = [13 x i8] c" PLL locked\0A\00"
@.str.14 = [15 x i8] c" PLL unlocked\0A\00"
define void @decode_ad9520_status(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = and i32 %7, 64
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %14
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = and i32 %16, 32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %23
21: ; preds = %14
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = and i32 %25, 16
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %32
30: ; preds = %23
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
%33 = load i8, i8* %2
%34 = zext i8 %33 to i32
%35 = and i32 %34, 8
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %41
39: ; preds = %32
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
br label %41
41: ; preds = %39, %37
%42 = load i8, i8* %2
%43 = zext i8 %42 to i32
%44 = and i32 %43, 4
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
br label %50
48: ; preds = %41
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
%51 = load i8, i8* %2
%52 = zext i8 %51 to i32
%53 = and i32 %52, 2
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %50
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0))
br label %59
57: ; preds = %50
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %59
59: ; preds = %57, %55
%60 = load i8, i8* %2
%61 = zext i8 %60 to i32
%62 = and i32 %61, 1
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %59
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
br label %68
66: ; preds = %59
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0))
br label %68
68: ; preds = %66, %64
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"\0AAD9520 status register decode value %02x:\0A\00"
@str = [20 x i8] c" VCO cal unfinished\00"
@str.15 = [21 x i8] c" holdover not active\00"
@str.16 = [15 x i8] c" REF1 selected\00"
@str.17 = [20 x i8] c" VCO freq < thrtesh\00"
@str.18 = [21 x i8] c" REF2 freq < thrtesh\00"
@str.19 = [21 x i8] c" REF1 freq < thrtesh\00"
@str.20 = [14 x i8] c" PLL unlocked\00"
@str.21 = [12 x i8] c" PLL locked\00"
@str.22 = [20 x i8] c" REF1 freq > thresh\00"
@str.23 = [20 x i8] c" REF2 freq > thresh\00"
@str.24 = [19 x i8] c" VCO freq > thresh\00"
@str.25 = [15 x i8] c" REF2 selected\00"
@str.26 = [17 x i8] c" holdover active\00"
@str.27 = [18 x i8] c" VCO cal finished\00"
define void @decode_ad9520_status(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = and i32 %2, 64
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.27, i64 0, i64 0)
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
%8 = and i32 %2, 32
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.15, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.26, i64 0, i64 0)
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = and i32 %2, 16
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.16, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.25, i64 0, i64 0)
%15 = tail call i32 @puts(i8* dereferenceable(1) %14)
%16 = and i32 %2, 8
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.17, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.24, i64 0, i64 0)
%19 = tail call i32 @puts(i8* dereferenceable(1) %18)
%20 = and i32 %2, 4
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.18, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.23, i64 0, i64 0)
%23 = tail call i32 @puts(i8* dereferenceable(1) %22)
%24 = and i32 %2, 2
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.19, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.22, i64 0, i64 0)
%27 = tail call i32 @puts(i8* dereferenceable(1) %26)
%28 = and i32 %2, 1
%29 = icmp eq i32 %28, 0
%30 = select i1 %29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.20, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.21, i64 0, i64 0)
%31 = tail call i32 @puts(i8* dereferenceable(1) %30)
ret void
}