#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 hsw_debug_sfuse_strap(char *result, int len, int reg, uint32_t val,
                           uint32_t devid) {
  const char *display, *crt, *lane_reversal, *portb, *portc, *portd;
  display = (val & (1 << 7)) ? "disabled" : "enabled";
  crt = (val & (1 << 6)) ? "yes" : "no";
  lane_reversal = (val & (1 << 4)) ? "yes" : "no";
  portb = (val & (1 << 2)) ? "yes" : "no";
  portc = (val & (1 << 1)) ? "yes" : "no";
  portd = (val & (1 << 0)) ? "yes" : "no";
  snprintf(result, len,
           "display %s, crt %s, lane reversal %s, "
           "port b %s, port c %s, port d %s",
           display, crt, lane_reversal, portb, portc, portd);
}


x86 assembly (clang, -O0):
<hsw_debug_sfuse_strap>:
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    $0x80,%edx
lea    0xed0(%rip),%rax
lea    0xec0(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edx
and    $0x40,%edx
lea    0xebd(%rip),%rax
lea    0xeb2(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edx
and    $0x10,%edx
lea    0xe9e(%rip),%rax
lea    0xe93(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edx
and    $0x4,%edx
lea    0xe7f(%rip),%rax
lea    0xe74(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edx
and    $0x2,%edx
lea    0xe60(%rip),%rax
lea    0xe55(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%edx
and    $0x1,%edx
lea    0xe41(%rip),%rax
lea    0xe36(%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    0xe0c(%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):
<hsw_debug_sfuse_strap>:
push   %rbx
test   $0x80,%cl
lea    0xeee(%rip),%rdx
lea    0xede(%rip),%r10
cmove  %rdx,%r10
test   $0x40,%cl
lea    0xee5(%rip),%rdx
lea    0xeda(%rip),%rax
mov    %rax,%r8
cmove  %rdx,%r8
test   $0x10,%cl
mov    %rax,%r9
cmove  %rdx,%r9
test   $0x4,%cl
mov    %rax,%r11
cmove  %rdx,%r11
test   $0x2,%cl
mov    %rax,%rbx
cmove  %rdx,%rbx
test   $0x1,%cl
cmove  %rdx,%rax
sub    $0x8,%rsp
lea    0xeaa(%rip),%rdx
mov    %r10,%rcx
push   %rax
push   %rbx
push   %r11
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"disabled\00"
@.str.1 = [8 x i8] c"enabled\00"
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [3 x i8] c"no\00"
@.str.4 = [70 x i8] c"display %s, crt %s, lane reversal %s, port b %s, port c %s, port d %s\00"
define void @hsw_debug_sfuse_strap(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, 128
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
store i8* %21, i8** %11
%22 = load i32, i32* %9
%23 = and i32 %22, 64
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
store i8* %26, i8** %12
%27 = load i32, i32* %9
%28 = and i32 %27, 16
%29 = icmp ne i32 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
store i8* %31, i8** %13
%32 = load i32, i32* %9
%33 = and i32 %32, 4
%34 = icmp ne i32 %33, 0
%35 = zext i1 %34 to i64
%36 = select i1 %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
store i8* %36, i8** %14
%37 = load i32, i32* %9
%38 = and i32 %37, 2
%39 = icmp ne i32 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
store i8* %41, i8** %15
%42 = load i32, i32* %9
%43 = and i32 %42, 1
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, 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 ([70 x i8], [70 x i8]* @.str.4, i64 0, i64 0), i8* %49, i8* %50, i8* %51, i8* %52, i8* %53, i8* %54)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"disabled\00"
@.str.1 = [8 x i8] c"enabled\00"
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [3 x i8] c"no\00"
@.str.4 = [70 x i8] c"display %s, crt %s, lane reversal %s, port b %s, port c %s, port d %s\00"
define void @hsw_debug_sfuse_strap(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = and i32 %3, 128
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
%9 = and i32 %3, 64
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%12 = and i32 %3, 16
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%15 = and i32 %3, 4
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%18 = and i32 %3, 2
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%21 = and i32 %3, 1
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%24 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.4, i64 0, i64 0), i8* %8, i8* %11, i8* %14, i8* %17, i8* %20, i8* %23)
ret void
}