#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *,
                            char const *, char const *, char const *,
                            char const *);
void i830_debug_dpll_test(char *result, int len, int reg, uint32_t val,
                          uint32_t devid) {
  const char *dpllandiv = val & (1 << 3) ? ", DPLLA N bypassed" : "";
  const char *dpllamdiv = val & (1 << 2) ? ", DPLLA M bypassed" : "";
  const char *dpllainput =
      val & (1 << 0) ? "" : ", DPLLA input buffer disabled";
  const char *dpllbndiv = val & (1 << 19) ? ", DPLLB N bypassed" : "";
  const char *dpllbmdiv = val & (1 << 18) ? ", DPLLB M bypassed" : "";
  const char *dpllbinput =
      val & (1 << 16) ? "" : ", DPLLB input buffer disabled";
  snprintf(result, len, "%s%s%s%s%s%s", dpllandiv, dpllamdiv, dpllainput,
           dpllbndiv, dpllbmdiv, dpllbinput);
}


x86 assembly (clang, -O0):
<i830_debug_dpll_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x14(%rbp),%edx
and    $0x8,%edx
lea    0xf0d(%rip),%rax
lea    0xec3(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edx
and    $0x4,%edx
lea    0xeee(%rip),%rax
lea    0xeb7(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edx
and    $0x1,%edx
lea    0xeb2(%rip),%rax
lea    0xec8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edx
and    $0x80000,%edx
lea    0xead(%rip),%rax
lea    0xea7(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edx
and    $0x40000,%edx
lea    0xe8b(%rip),%rax
lea    0xe98(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%edx
and    $0x10000,%edx
lea    0xe90(%rip),%rax
lea    0xe62(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x38(%rbp),%r11
mov    -0x40(%rbp),%r10
mov    -0x48(%rbp),%rax
lea    0xe76(%rip),%rdx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <snprintf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i830_debug_dpll_test>:
push   %rbx
test   $0x8,%cl
lea    0xf28(%rip),%rdx
lea    0xede(%rip),%r10
cmove  %rdx,%r10
test   $0x4,%cl
lea    0xee3(%rip),%r8
cmove  %rdx,%r8
test   $0x1,%cl
lea    0xee8(%rip),%r9
cmovne %rdx,%r9
test   $0x80000,%ecx
lea    0xef5(%rip),%r11
cmove  %rdx,%r11
test   $0x40000,%ecx
lea    0xef7(%rip),%rax
cmove  %rdx,%rax
test   $0x10000,%ecx
lea    0xef9(%rip),%rbx
cmovne %rdx,%rbx
sub    $0x8,%rsp
lea    0xf08(%rip),%rdx
mov    %r10,%rcx
push   %rbx
push   %rax
push   %r11
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c", DPLLA N bypassed\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [19 x i8] c", DPLLA M bypassed\00"
@.str.3 = [30 x i8] c", DPLLA input buffer disabled\00"
@.str.4 = [19 x i8] c", DPLLB N bypassed\00"
@.str.5 = [19 x i8] c", DPLLB M bypassed\00"
@.str.6 = [30 x i8] c", DPLLB input buffer disabled\00"
@.str.7 = [13 x i8] c"%s%s%s%s%s%s\00"
define void @i830_debug_dpll_test(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%17 = load i32, i32* %9
%18 = and i32 %17, 8
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
store i8* %21, i8** %11
%22 = load i32, i32* %9
%23 = and i32 %22, 4
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
store i8* %26, i8** %12
%27 = load i32, i32* %9
%28 = and i32 %27, 1
%29 = icmp ne i32 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0)
store i8* %31, i8** %13
%32 = load i32, i32* %9
%33 = and i32 %32, 524288
%34 = icmp ne i32 %33, 0
%35 = zext i1 %34 to i64
%36 = select i1 %34, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
store i8* %36, i8** %14
%37 = load i32, i32* %9
%38 = and i32 %37, 262144
%39 = icmp ne i32 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
store i8* %41, i8** %15
%42 = load i32, i32* %9
%43 = and i32 %42, 65536
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0)
store i8* %46, i8** %16
%47 = load i8*, i8** %6
%48 = load i32, i32* %7
%49 = load i8*, i8** %11
%50 = load i8*, i8** %12
%51 = load i8*, i8** %13
%52 = load i8*, i8** %14
%53 = load i8*, i8** %15
%54 = load i8*, i8** %16
%55 = call i32 @snprintf(i8* %47, i32 %48, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %49, i8* %50, i8* %51, i8* %52, i8* %53, i8* %54)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c", DPLLA N bypassed\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [19 x i8] c", DPLLA M bypassed\00"
@.str.3 = [30 x i8] c", DPLLA input buffer disabled\00"
@.str.4 = [19 x i8] c", DPLLB N bypassed\00"
@.str.5 = [19 x i8] c", DPLLB M bypassed\00"
@.str.6 = [30 x i8] c", DPLLB input buffer disabled\00"
@.str.7 = [13 x i8] c"%s%s%s%s%s%s\00"
define void @i830_debug_dpll_test(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = and i32 %3, 8
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
%9 = and i32 %3, 4
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0)
%12 = and i32 %3, 1
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
%15 = and i32 %3, 524288
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0)
%18 = and i32 %3, 262144
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0)
%21 = and i32 %3, 65536
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
%24 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* %8, i8* %11, i8* %14, i8* %17, i8* %20, i8* %23)
ret void
}