#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 *, char *, char *, char *,
                            char *, char const *, char const *, char *, char *,
                            char *);
void ironlake_debug_panel_fitting(char *result, int len, int reg, uint32_t val,
                                  uint32_t devid) {
  const char *vadapt = NULL, *filter_sel = NULL;
  switch (val & (3 << 25)) {
  case 0:
    vadapt = "least";
    break;
  case (1 << 25):
    vadapt = "moderate";
    break;
  case (2 << 25):
    vadapt = "reserved";
    break;
  case (3 << 25):
    vadapt = "most";
    break;
  }
  switch (val & (3 << 23)) {
  case 0:
    filter_sel = "programmed";
    break;
  case (1 << 23):
    filter_sel = "hardcoded";
    break;
  case (2 << 23):
    filter_sel = "edge_enhance";
    break;
  case (3 << 23):
    filter_sel = "edge_soften";
    break;
  }
  snprintf(result, len,
           "%s, auto_scale %s, auto_scale_cal %s, v_filter %s, vadapt %s, mode "
           "%s, filter_sel %s,"
           "chroma pre-filter %s, vert3tap %s, v_inter_invert %s",
           val & (1 << 31) ? "enable" : "disable",
           val & (1 << 30) ? "no" : "yes", val & (1 << 29) ? "yes" : "no",
           val & (1 << 28) ? "bypass" : "enable",
           val & (1 << 27) ? "enable" : "disable", vadapt, filter_sel,
           val & (1 << 22) ? "enable" : "disable",
           val & (1 << 21) ? "force" : "auto",
           val & (1 << 20) ? "field 0" : "field 1");
}


x86 assembly (clang, -O0):
<ironlake_debug_panel_fitting>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rdi,-0x30(%rbp)
mov    %esi,-0x34(%rbp)
mov    %edx,-0x38(%rbp)
mov    %ecx,-0x3c(%rbp)
mov    %r8d,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
and    $0x6000000,%eax
mov    %eax,-0x54(%rbp)
je     1191 <ironlake_debug_panel_fitting+0x81>
jmp    1158 <ironlake_debug_panel_fitting+0x48>
mov    -0x54(%rbp),%eax
sub    $0x2000000,%eax
je     11a1 <ironlake_debug_panel_fitting+0x91>
jmp    116b <ironlake_debug_panel_fitting+0x5b>
mov    -0x54(%rbp),%eax
sub    $0x4000000,%eax
je     11b1 <ironlake_debug_panel_fitting+0xa1>
jmp    117e <ironlake_debug_panel_fitting+0x6e>
mov    -0x54(%rbp),%eax
sub    $0x6000000,%eax
je     11c1 <ironlake_debug_panel_fitting+0xb1>
jmp    11cc <ironlake_debug_panel_fitting+0xbc>
lea    0xe68(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    11cc <ironlake_debug_panel_fitting+0xbc>
lea    0xe5e(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    11cc <ironlake_debug_panel_fitting+0xbc>
lea    0xe57(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    11cc <ironlake_debug_panel_fitting+0xbc>
lea    0xe50(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
and    $0x1800000,%eax
mov    %eax,-0x58(%rbp)
je     121b <ironlake_debug_panel_fitting+0x10b>
jmp    11e2 <ironlake_debug_panel_fitting+0xd2>
mov    -0x58(%rbp),%eax
sub    $0x800000,%eax
je     122b <ironlake_debug_panel_fitting+0x11b>
jmp    11f5 <ironlake_debug_panel_fitting+0xe5>
mov    -0x58(%rbp),%eax
sub    $0x1000000,%eax
je     123b <ironlake_debug_panel_fitting+0x12b>
jmp    1208 <ironlake_debug_panel_fitting+0xf8>
mov    -0x58(%rbp),%eax
sub    $0x1800000,%eax
je     124b <ironlake_debug_panel_fitting+0x13b>
jmp    1256 <ironlake_debug_panel_fitting+0x146>
lea    0xdfb(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    1256 <ironlake_debug_panel_fitting+0x146>
lea    0xdf6(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    1256 <ironlake_debug_panel_fitting+0x146>
lea    0xdf0(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    1256 <ironlake_debug_panel_fitting+0x146>
lea    0xded(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x3c(%rbp),%edx
and    $0x80000000,%edx
lea    0xe6f(%rip),%rcx
lea    0xe61(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rcx
mov    -0x3c(%rbp),%edx
and    $0x40000000,%edx
lea    0xe5c(%rip),%r8
lea    0xe52(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%r8
mov    -0x3c(%rbp),%edx
and    $0x20000000,%edx
lea    0xe3b(%rip),%r9
lea    0xe37(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%r9
mov    -0x3c(%rbp),%edx
and    $0x10000000,%edx
lea    0xe0e(%rip),%r12
lea    0xe1d(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%r12
mov    -0x3c(%rbp),%edx
and    $0x8000000,%edx
lea    0xdf7(%rip),%r15
lea    0xde9(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%r15
mov    -0x48(%rbp),%r14
mov    -0x50(%rbp),%rbx
mov    -0x3c(%rbp),%edx
and    $0x400000,%edx
lea    0xdd1(%rip),%r11
lea    0xdc3(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%r11
mov    -0x3c(%rbp),%edx
and    $0x200000,%edx
lea    0xdcf(%rip),%r10
lea    0xdc2(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%r10
mov    -0x3c(%rbp),%r13d
and    $0x100000,%r13d
lea    0xdbc(%rip),%rax
lea    0xdad(%rip),%rdx
cmp    $0x0,%r13d
cmovne %rdx,%rax
lea    0xcec(%rip),%rdx
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <snprintf@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<ironlake_debug_panel_fitting>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %ecx,%eax
shr    $0x19,%eax
and    $0x3,%eax
lea    0xfe8(%rip),%rdx
movslq (%rdx,%rax,4),%r10
add    %rdx,%r10
mov    %ecx,%eax
shr    $0x17,%eax
and    $0x3,%eax
lea    0xfe2(%rip),%rdx
movslq (%rdx,%rax,4),%r11
add    %rdx,%r11
test   %ecx,%ecx
lea    0xf8e(%rip),%rdx
lea    0xf80(%rip),%rbx
mov    %rbx,%r15
cmovns %rdx,%r15
test   $0x40000000,%ecx
lea    0xf7e(%rip),%r9
lea    0xf74(%rip),%rax
mov    %rax,%r8
cmove  %r9,%r8
test   $0x20000000,%ecx
cmove  %rax,%r9
test   $0x10000000,%ecx
lea    0xf5d(%rip),%r14
cmove  %rbx,%r14
test   $0x8000000,%ecx
mov    %rbx,%r12
cmove  %rdx,%r12
test   $0x400000,%ecx
cmove  %rdx,%rbx
test   $0x200000,%ecx
lea    0xf42(%rip),%rdx
lea    0xf35(%rip),%r13
cmove  %rdx,%r13
test   $0x100000,%ecx
lea    0xf37(%rip),%rcx
lea    0xf28(%rip),%rax
cmove  %rcx,%rax
sub    $0x8,%rsp
lea    0xe67(%rip),%rdx
mov    %r15,%rcx
push   %rax
push   %r13
push   %rbx
push   %r11
push   %r10
push   %r12
push   %r14
call   1030 <snprintf@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"least\00"
@.str.1 = [9 x i8] c"moderate\00"
@.str.2 = [9 x i8] c"reserved\00"
@.str.3 = [5 x i8] c"most\00"
@.str.4 = [11 x i8] c"programmed\00"
@.str.5 = [10 x i8] c"hardcoded\00"
@.str.6 = [13 x i8] c"edge_enhance\00"
@.str.7 = [12 x i8] c"edge_soften\00"
@.str.8 = [138 x i8] c"%s, auto_scale %s, auto_scale_cal %s, v_filter %s, vadapt %s, mode %s, filter_sel %s,chroma pre-filter %s, vert3tap %s, v_inter_invert %s\00"
@.str.9 = [7 x i8] c"enable\00"
@.str.10 = [8 x i8] c"disable\00"
@.str.11 = [3 x i8] c"no\00"
@.str.12 = [4 x i8] c"yes\00"
@.str.13 = [7 x i8] c"bypass\00"
@.str.14 = [6 x i8] c"force\00"
@.str.15 = [5 x i8] c"auto\00"
@.str.16 = [8 x i8] c"field 0\00"
@.str.17 = [8 x i8] c"field 1\00"
define void @ironlake_debug_panel_fitting(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*
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
store i8* null, i8** %11
store i8* null, i8** %12
%13 = load i32, i32* %9
%14 = and i32 %13, 100663296
switch i32 %14, label %19 [
i32 0, label %15
i32 33554432, label %16
i32 67108864, label %17
i32 100663296, label %18
]
15: ; preds = %5
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %11
br label %19
16: ; preds = %5
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %11
br label %19
17: ; preds = %5
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %11
br label %19
18: ; preds = %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %11
br label %19
19: ; preds = %5, %18, %17, %16, %15
%20 = load i32, i32* %9
%21 = and i32 %20, 25165824
switch i32 %21, label %26 [
i32 0, label %22
i32 8388608, label %23
i32 16777216, label %24
i32 25165824, label %25
]
22: ; preds = %19
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8** %12
br label %26
23: ; preds = %19
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %12
br label %26
24: ; preds = %19
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8** %12
br label %26
25: ; preds = %19
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8** %12
br label %26
26: ; preds = %19, %25, %24, %23, %22
%27 = load i8*, i8** %6
%28 = load i32, i32* %7
%29 = load i32, i32* %9
%30 = and i32 %29, -2147483648
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0)
%34 = load i32, i32* %9
%35 = and i32 %34, 1073741824
%36 = icmp ne i32 %35, 0
%37 = zext i1 %36 to i64
%38 = select i1 %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0)
%39 = load i32, i32* %9
%40 = and i32 %39, 536870912
%41 = icmp ne i32 %40, 0
%42 = zext i1 %41 to i64
%43 = select i1 %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0)
%44 = load i32, i32* %9
%45 = and i32 %44, 268435456
%46 = icmp ne i32 %45, 0
%47 = zext i1 %46 to i64
%48 = select i1 %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0)
%49 = load i32, i32* %9
%50 = and i32 %49, 134217728
%51 = icmp ne i32 %50, 0
%52 = zext i1 %51 to i64
%53 = select i1 %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0)
%54 = load i8*, i8** %11
%55 = load i8*, i8** %12
%56 = load i32, i32* %9
%57 = and i32 %56, 4194304
%58 = icmp ne i32 %57, 0
%59 = zext i1 %58 to i64
%60 = select i1 %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0)
%61 = load i32, i32* %9
%62 = and i32 %61, 2097152
%63 = icmp ne i32 %62, 0
%64 = zext i1 %63 to i64
%65 = select i1 %63, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0)
%66 = load i32, i32* %9
%67 = and i32 %66, 1048576
%68 = icmp ne i32 %67, 0
%69 = zext i1 %68 to i64
%70 = select i1 %68, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0)
%71 = call i32 @snprintf(i8* %27, i32 %28, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.8, i64 0, i64 0), i8* %33, i8* %38, i8* %43, i8* %48, i8* %53, i8* %54, i8* %55, i8* %60, i8* %65, i8* %70)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"least\00"
@.str.1 = [9 x i8] c"moderate\00"
@.str.2 = [9 x i8] c"reserved\00"
@.str.3 = [5 x i8] c"most\00"
@.str.4 = [11 x i8] c"programmed\00"
@.str.5 = [10 x i8] c"hardcoded\00"
@.str.6 = [13 x i8] c"edge_enhance\00"
@.str.7 = [12 x i8] c"edge_soften\00"
@.str.8 = [138 x i8] c"%s, auto_scale %s, auto_scale_cal %s, v_filter %s, vadapt %s, mode %s, filter_sel %s,chroma pre-filter %s, vert3tap %s, v_inter_invert %s\00"
@.str.9 = [7 x i8] c"enable\00"
@.str.10 = [8 x i8] c"disable\00"
@.str.11 = [3 x i8] c"no\00"
@.str.12 = [4 x i8] c"yes\00"
@.str.13 = [7 x i8] c"bypass\00"
@.str.14 = [6 x i8] c"force\00"
@.str.15 = [5 x i8] c"auto\00"
@.str.16 = [8 x i8] c"field 0\00"
@.str.17 = [8 x i8] c"field 1\00"
@reltable.ironlake_debug_panel_fitting = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.ironlake_debug_panel_fitting to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.ironlake_debug_panel_fitting to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.ironlake_debug_panel_fitting to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.ironlake_debug_panel_fitting to i64)) to i32)]
@reltable.ironlake_debug_panel_fitting.19 = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.ironlake_debug_panel_fitting.19 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.5 to i64), i64 ptrtoint ([4 x i32]* @reltable.ironlake_debug_panel_fitting.19 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.6 to i64), i64 ptrtoint ([4 x i32]* @reltable.ironlake_debug_panel_fitting.19 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.7 to i64), i64 ptrtoint ([4 x i32]* @reltable.ironlake_debug_panel_fitting.19 to i64)) to i32)]
define void @ironlake_debug_panel_fitting(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = lshr i32 %3, 25
%7 = and i32 %6, 3
%8 = zext i32 %7 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.ironlake_debug_panel_fitting to i8*), i64 %9)
%11 = lshr i32 %3, 23
%12 = and i32 %11, 3
%13 = zext i32 %12 to i64
%14 = shl i64 %13, 2
%15 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.ironlake_debug_panel_fitting.19 to i8*), i64 %14)
%16 = icmp sgt i32 %3, -1
%17 = select i1 %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0)
%18 = and i32 %3, 1073741824
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0)
%21 = and i32 %3, 536870912
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0)
%24 = and i32 %3, 268435456
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0)
%27 = and i32 %3, 134217728
%28 = icmp eq i32 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0)
%30 = and i32 %3, 4194304
%31 = icmp eq i32 %30, 0
%32 = select i1 %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0)
%33 = and i32 %3, 2097152
%34 = icmp eq i32 %33, 0
%35 = select i1 %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0)
%36 = and i32 %3, 1048576
%37 = icmp eq i32 %36, 0
%38 = select i1 %37, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0)
%39 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.8, i64 0, i64 0), i8* %17, i8* %20, i8* %23, i8* %26, i8* %29, i8* %10, i8* %15, i8* %32, i8* %35, i8* %38)
ret void
}