#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 *, int, int, int, int);
void hsw_debug_sinterrupt(char *result, int len, int reg, uint32_t val,
                          uint32_t devid) {
  int portd, portc, portb, crt;
  portd = (val >> 23) & 1;
  portc = (val >> 22) & 1;
  portb = (val >> 21) & 1;
  crt = (val >> 19) & 1;
  snprintf(result, len, "port d:%d, port c:%d, port b:%d, crt:%d", portd, portc,
           portb, crt);
}


x86 assembly (clang, -O0):
<hsw_debug_sinterrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x17,%eax
and    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x16,%eax
and    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x15,%eax
and    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x13,%eax
and    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%eax
lea    0xe8b(%rip),%rdx
mov    %eax,(%rsp)
call   1030 <snprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hsw_debug_sinterrupt>:
push   %rax
mov    %ecx,%eax
shr    $0x17,%eax
and    $0x1,%eax
mov    %ecx,%r8d
shr    $0x16,%r8d
and    $0x1,%r8d
mov    %ecx,%r9d
shr    $0x15,%r9d
and    $0x1,%r9d
shr    $0x13,%ecx
and    $0x1,%ecx
mov    %ecx,(%rsp)
lea    0xec1(%rip),%rdx
mov    %eax,%ecx
call   1030 <snprintf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [40 x i8] c"port d:%d, port c:%d, port b:%d, crt:%d\00"
define void @hsw_debug_sinterrupt(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 i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
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
%15 = load i32, i32* %9
%16 = ashr i32 %15, 23
%17 = and i32 %16, 1
store i32 %17, i32* %11
%18 = load i32, i32* %9
%19 = ashr i32 %18, 22
%20 = and i32 %19, 1
store i32 %20, i32* %12
%21 = load i32, i32* %9
%22 = ashr i32 %21, 21
%23 = and i32 %22, 1
store i32 %23, i32* %13
%24 = load i32, i32* %9
%25 = ashr i32 %24, 19
%26 = and i32 %25, 1
store i32 %26, i32* %14
%27 = load i8*, i8** %6
%28 = load i32, i32* %7
%29 = load i32, i32* %11
%30 = load i32, i32* %12
%31 = load i32, i32* %13
%32 = load i32, i32* %14
%33 = call i32 @snprintf(i8* %27, i32 %28, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30, i32 %31, i32 %32)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"port d:%d, port c:%d, port b:%d, crt:%d\00"
define void @hsw_debug_sinterrupt(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = lshr i32 %3, 23
%7 = and i32 %6, 1
%8 = lshr i32 %3, 22
%9 = and i32 %8, 1
%10 = lshr i32 %3, 21
%11 = and i32 %10, 1
%12 = lshr i32 %3, 19
%13 = and i32 %12, 1
%14 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9, i32 %11, i32 %13)
ret void
}