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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void dump_serial_ext(u_char *p, int len) {
  static const char *type[] = {"",        "Modem",      "Data",      "Fax",
                               "Voice",   "Data modem", "Fax/modem", "Voice",
                               " (Data)", " (Fax)",     " (Voice)"};
  if (len < 1)
    return;
  switch (p[0]) {
  case 0:
  case 8:
  case 9:
  case 10:
    printf("\tSerial interface extension:%s\n", type[*p]);
    if (len < 4)
      goto err;
    switch (p[1] & 0x1F) {
    default:
      printf("\t\tUnknown device");
      break;
    case 0:
      printf("\t\t8250 UART");
      break;
    case 1:
      printf("\t\t16450 UART");
      break;
    case 2:
      printf("\t\t16550 UART");
      break;
    }
    printf(", Parity - %s%s%s%s\n", (p[2] & 1) ? "Space," : "",
           (p[2] & 2) ? "Mark," : "", (p[2] & 4) ? "Odd," : "",
           (p[2] & 8) ? "Even" : "");
    printf("\t\tData bit - %s%s%s%s Stop bit - %s%s%s\n",
           (p[3] & 1) ? "5bit," : "", (p[3] & 2) ? "6bit," : "",
           (p[3] & 4) ? "7bit," : "", (p[3] & 8) ? "8bit," : "",
           (p[3] & 0x10) ? "1bit," : "", (p[3] & 0x20) ? "1.5bit," : "",
           (p[3] & 0x40) ? "2bit" : "");
    break;
  case 1:
  case 5:
  case 6:
  case 7:
    printf("\t%s interface capabilities:\n", type[*p]);
    if (len < 9)
      goto err;
    break;
  case 2:
    printf("\tData modem services available:\n");
    break;
  case 0x13:
  case 0x23:
  case 0x33:
    printf("\tFax%d/modem services available:\n", *p >> 4);
    break;
  case 0x84:
    printf("\tVoice services available:\n");
    break;
  err:
    printf("\tWrong length for serial extension tuple\n");
    return;
  }
}


x86 assembly (clang, -O0):
<dump_serial_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    112e <dump_serial_ext+0x1e>
jmp    148a <dump_serial_ext+0x37a>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     11d4 <dump_serial_ext+0xc4>
jmp    1144 <dump_serial_ext+0x34>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1406 <dump_serial_ext+0x2f6>
jmp    1155 <dump_serial_ext+0x45>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     143a <dump_serial_ext+0x32a>
jmp    1166 <dump_serial_ext+0x56>
mov    -0x10(%rbp),%eax
add    $0xfffffffb,%eax
sub    $0x3,%eax
jb     1406 <dump_serial_ext+0x2f6>
jmp    117a <dump_serial_ext+0x6a>
mov    -0x10(%rbp),%eax
add    $0xfffffff8,%eax
sub    $0x3,%eax
jb     11d4 <dump_serial_ext+0xc4>
jmp    118e <dump_serial_ext+0x7e>
mov    -0x10(%rbp),%eax
sub    $0x13,%eax
je     144d <dump_serial_ext+0x33d>
jmp    119f <dump_serial_ext+0x8f>
mov    -0x10(%rbp),%eax
sub    $0x23,%eax
je     144d <dump_serial_ext+0x33d>
jmp    11b0 <dump_serial_ext+0xa0>
mov    -0x10(%rbp),%eax
sub    $0x33,%eax
je     144d <dump_serial_ext+0x33d>
jmp    11c1 <dump_serial_ext+0xb1>
mov    -0x10(%rbp),%eax
sub    $0x84,%eax
je     1469 <dump_serial_ext+0x359>
jmp    148a <dump_serial_ext+0x37a>
mov    -0x8(%rbp),%rax
movslq (%rax),%rcx
lea    0x2e4e(%rip),%rax
mov    (%rax,%rcx,8),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x4,-0xc(%rbp)
jge    1203 <dump_serial_ext+0xf3>
jmp    147c <dump_serial_ext+0x36c>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
and    $0x1f,%eax
mov    %eax,-0x14(%rbp)
je     1250 <dump_serial_ext+0x140>
jmp    121b <dump_serial_ext+0x10b>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1263 <dump_serial_ext+0x153>
jmp    122c <dump_serial_ext+0x11c>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1276 <dump_serial_ext+0x166>
jmp    123d <dump_serial_ext+0x12d>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1284 <dump_serial_ext+0x174>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1284 <dump_serial_ext+0x174>
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1284 <dump_serial_ext+0x174>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
and    $0x1,%ecx
lea    0xef9(%rip),%rsi
lea    0xe12(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
and    $0x2,%ecx
lea    0xeda(%rip),%rdx
lea    0xdfa(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
and    $0x4,%edi
lea    0xebb(%rip),%rcx
lea    0xde1(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
and    $0x8,%edi
lea    0xe9c(%rip),%r8
lea    0xdc7(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r8
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%ecx
and    $0x1,%ecx
lea    0xe6f(%rip),%rsi
lea    0xde2(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%ecx
and    $0x2,%ecx
lea    0xe50(%rip),%rdx
lea    0xda9(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
and    $0x4,%edi
lea    0xe31(%rip),%rcx
lea    0xd90(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
and    $0x8,%edi
lea    0xe12(%rip),%r8
lea    0xd77(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r8
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
and    $0x10,%edi
lea    0xdf3(%rip),%r9
lea    0xd5e(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r9
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
and    $0x20,%edi
lea    0xdd4(%rip),%r10
lea    0xd45(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r10
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%r11d
and    $0x40,%r11d
lea    0xdb3(%rip),%rax
lea    0xd2c(%rip),%rdi
cmp    $0x0,%r11d
cmovne %rdi,%rax
lea    0xcd4(%rip),%rdi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
jmp    148a <dump_serial_ext+0x37a>
mov    -0x8(%rbp),%rax
movslq (%rax),%rcx
lea    0x2c1c(%rip),%rax
mov    (%rax,%rcx,8),%rsi
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x9,-0xc(%rbp)
jge    1435 <dump_serial_ext+0x325>
jmp    147c <dump_serial_ext+0x36c>
jmp    148a <dump_serial_ext+0x37a>
lea    0xcef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    148a <dump_serial_ext+0x37a>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
sar    $0x4,%esi
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    148a <dump_serial_ext+0x37a>
lea    0xd03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    148a <dump_serial_ext+0x37a>
lea    0xd0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_serial_ext>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    12b7 <dump_serial_ext+0x197>
mov    %esi,%ebp
mov    %rdi,%rbx
mov    (%rdi),%esi
cmp    $0x33,%rsi
ja     11cd <dump_serial_ext+0xad>
lea    0xebc(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0x2c6c(%rip),%rax
mov    (%rax,%rsi,8),%rsi
lea    0xfbf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x4,%ebp
jb     11a8 <dump_serial_ext+0x88>
mov    0x4(%rbx),%eax
and    $0x1f,%eax
cmp    $0x2,%eax
ja     11eb <dump_serial_ext+0xcb>
lea    0xf53(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    11f2 <dump_serial_ext+0xd2>
lea    0x2c33(%rip),%rax
mov    (%rax,%rsi,8),%rsi
lea    0x1057(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x9,%ebp
jae    12b7 <dump_serial_ext+0x197>
lea    0x10ba(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <puts@plt>
shr    $0x4,%esi
lea    0x104a(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>
cmp    $0x84,%esi
jne    12b7 <dump_serial_ext+0x197>
lea    0x104e(%rip),%rdi
jmp    11af <dump_serial_ext+0x8f>
lea    0x1060(%rip),%rdi
jmp    11af <dump_serial_ext+0x8f>
lea    0xf4c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%eax
test   $0x1,%al
lea    0x1028(%rip),%r14
lea    0xf7e(%rip),%rsi
cmove  %r14,%rsi
test   $0x2,%al
lea    0xf78(%rip),%rdx
cmove  %r14,%rdx
test   $0x4,%al
lea    0xf71(%rip),%rcx
cmove  %r14,%rcx
test   $0x8,%al
lea    0xf69(%rip),%r8
cmove  %r14,%r8
lea    0xf37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rbx),%eax
test   $0x1,%al
lea    0xf93(%rip),%rsi
cmove  %r14,%rsi
test   $0x2,%al
lea    0xf6c(%rip),%rdx
cmove  %r14,%rdx
test   $0x4,%al
lea    0xf65(%rip),%rcx
cmove  %r14,%rcx
test   $0x8,%al
lea    0xf5e(%rip),%r8
cmove  %r14,%r8
test   $0x10,%al
lea    0xf57(%rip),%r9
cmove  %r14,%r9
test   $0x20,%al
lea    0xf50(%rip),%rbx
cmove  %r14,%rbx
test   $0x40,%al
lea    0xf4b(%rip),%rbp
cmove  %r14,%rbp
lea    0xef7(%rip),%rdi
xor    %eax,%eax
push   %rbp
push   %rbx
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@dump_serial_ext.type = internal global [11 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0)]
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"Modem\00"
@.str.2 = [5 x i8] c"Data\00"
@.str.3 = [4 x i8] c"Fax\00"
@.str.4 = [6 x i8] c"Voice\00"
@.str.5 = [11 x i8] c"Data modem\00"
@.str.6 = [10 x i8] c"Fax/modem\00"
@.str.7 = [8 x i8] c" (Data)\00"
@.str.8 = [7 x i8] c" (Fax)\00"
@.str.9 = [9 x i8] c" (Voice)\00"
@.str.10 = [32 x i8] c"\09Serial interface extension:%s\0A\00"
@.str.11 = [17 x i8] c"\09\09Unknown device\00"
@.str.12 = [12 x i8] c"\09\098250 UART\00"
@.str.13 = [13 x i8] c"\09\0916450 UART\00"
@.str.14 = [13 x i8] c"\09\0916550 UART\00"
@.str.15 = [21 x i8] c", Parity - %s%s%s%s\0A\00"
@.str.16 = [7 x i8] c"Space,\00"
@.str.17 = [6 x i8] c"Mark,\00"
@.str.18 = [5 x i8] c"Odd,\00"
@.str.19 = [5 x i8] c"Even\00"
@.str.20 = [41 x i8] c"\09\09Data bit - %s%s%s%s Stop bit - %s%s%s\0A\00"
@.str.21 = [6 x i8] c"5bit,\00"
@.str.22 = [6 x i8] c"6bit,\00"
@.str.23 = [6 x i8] c"7bit,\00"
@.str.24 = [6 x i8] c"8bit,\00"
@.str.25 = [6 x i8] c"1bit,\00"
@.str.26 = [8 x i8] c"1.5bit,\00"
@.str.27 = [5 x i8] c"2bit\00"
@.str.28 = [29 x i8] c"\09%s interface capabilities:\0A\00"
@.str.29 = [33 x i8] c"\09Data modem services available:\0A\00"
@.str.30 = [34 x i8] c"\09Fax%d/modem services available:\0A\00"
@.str.31 = [28 x i8] c"\09Voice services available:\0A\00"
@.str.32 = [42 x i8] c"\09Wrong length for serial extension tuple\0A\00"
define void @dump_serial_ext(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %2
br label %137
8: ; preds = %2
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
switch i32 %11, label %137 [
i32 0, label %12
i32 8, label %12
i32 9, label %12
i32 10, label %12
i32 1, label %115
i32 5, label %115
i32 6, label %115
i32 7, label %115
i32 2, label %126
i32 19, label %128
i32 35, label %128
i32 51, label %128
i32 132, label %133
]
12: ; preds = %8, %8, %8, %8
%13 = load i32*, i32** %3
%14 = load i32, i32* %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [11 x i8*], [11 x i8*]* @dump_serial_ext.type, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i8* %17)
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 4
br i1 %20, label %21, label %22
21: ; preds = %12
br label %135
22: ; preds = %12
%23 = load i32*, i32** %3
%24 = getelementptr inbounds i32, i32* %23, i64 1
%25 = load i32, i32* %24
%26 = and i32 %25, 31
switch i32 %26, label %27 [
i32 0, label %29
i32 1, label %31
i32 2, label %33
]
27: ; preds = %22
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %35
29: ; preds = %22
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
br label %35
31: ; preds = %22
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0))
br label %35
33: ; preds = %22
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
br label %35
35: ; preds = %33, %31, %29, %27
%36 = load i32*, i32** %3
%37 = getelementptr inbounds i32, i32* %36, i64 2
%38 = load i32, i32* %37
%39 = and i32 %38, 1
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%43 = load i32*, i32** %3
%44 = getelementptr inbounds i32, i32* %43, i64 2
%45 = load i32, i32* %44
%46 = and i32 %45, 2
%47 = icmp ne i32 %46, 0
%48 = zext i1 %47 to i64
%49 = select i1 %47, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%50 = load i32*, i32** %3
%51 = getelementptr inbounds i32, i32* %50, i64 2
%52 = load i32, i32* %51
%53 = and i32 %52, 4
%54 = icmp ne i32 %53, 0
%55 = zext i1 %54 to i64
%56 = select i1 %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%57 = load i32*, i32** %3
%58 = getelementptr inbounds i32, i32* %57, i64 2
%59 = load i32, i32* %58
%60 = and i32 %59, 8
%61 = icmp ne i32 %60, 0
%62 = zext i1 %61 to i64
%63 = select i1 %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* %42, i8* %49, i8* %56, i8* %63)
%65 = load i32*, i32** %3
%66 = getelementptr inbounds i32, i32* %65, i64 3
%67 = load i32, i32* %66
%68 = and i32 %67, 1
%69 = icmp ne i32 %68, 0
%70 = zext i1 %69 to i64
%71 = select i1 %69, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%72 = load i32*, i32** %3
%73 = getelementptr inbounds i32, i32* %72, i64 3
%74 = load i32, i32* %73
%75 = and i32 %74, 2
%76 = icmp ne i32 %75, 0
%77 = zext i1 %76 to i64
%78 = select i1 %76, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%79 = load i32*, i32** %3
%80 = getelementptr inbounds i32, i32* %79, i64 3
%81 = load i32, i32* %80
%82 = and i32 %81, 4
%83 = icmp ne i32 %82, 0
%84 = zext i1 %83 to i64
%85 = select i1 %83, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%86 = load i32*, i32** %3
%87 = getelementptr inbounds i32, i32* %86, i64 3
%88 = load i32, i32* %87
%89 = and i32 %88, 8
%90 = icmp ne i32 %89, 0
%91 = zext i1 %90 to i64
%92 = select i1 %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%93 = load i32*, i32** %3
%94 = getelementptr inbounds i32, i32* %93, i64 3
%95 = load i32, i32* %94
%96 = and i32 %95, 16
%97 = icmp ne i32 %96, 0
%98 = zext i1 %97 to i64
%99 = select i1 %97, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.25, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%100 = load i32*, i32** %3
%101 = getelementptr inbounds i32, i32* %100, i64 3
%102 = load i32, i32* %101
%103 = and i32 %102, 32
%104 = icmp ne i32 %103, 0
%105 = zext i1 %104 to i64
%106 = select i1 %104, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.26, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%107 = load i32*, i32** %3
%108 = getelementptr inbounds i32, i32* %107, i64 3
%109 = load i32, i32* %108
%110 = and i32 %109, 64
%111 = icmp ne i32 %110, 0
%112 = zext i1 %111 to i64
%113 = select i1 %111, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0), i8* %71, i8* %78, i8* %85, i8* %92, i8* %99, i8* %106, i8* %113)
br label %137
115: ; preds = %8, %8, %8, %8
%116 = load i32*, i32** %3
%117 = load i32, i32* %116
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [11 x i8*], [11 x i8*]* @dump_serial_ext.type, i64 0, i64 %118
%120 = load i8*, i8** %119
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.28, i64 0, i64 0), i8* %120)
%122 = load i32, i32* %4
%123 = icmp slt i32 %122, 9
br i1 %123, label %124, label %125
124: ; preds = %115
br label %135
125: ; preds = %115
br label %137
126: ; preds = %8
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.29, i64 0, i64 0))
br label %137
128: ; preds = %8, %8, %8
%129 = load i32*, i32** %3
%130 = load i32, i32* %129
%131 = ashr i32 %130, 4
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.30, i64 0, i64 0), i32 %131)
br label %137
133: ; preds = %8
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.31, i64 0, i64 0))
br label %137
135: ; preds = %124, %21
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.32, i64 0, i64 0))
br label %137
137: ; preds = %7, %135, %8, %133, %128, %126, %125, %35
ret void
}

LLVM IR (-O2):
@dump_serial_ext.type = internal unnamed_addr constant [11 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i32 0, i32 0)]
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"Modem\00"
@.str.2 = [5 x i8] c"Data\00"
@.str.3 = [4 x i8] c"Fax\00"
@.str.4 = [6 x i8] c"Voice\00"
@.str.5 = [11 x i8] c"Data modem\00"
@.str.6 = [10 x i8] c"Fax/modem\00"
@.str.7 = [8 x i8] c" (Data)\00"
@.str.8 = [7 x i8] c" (Fax)\00"
@.str.9 = [9 x i8] c" (Voice)\00"
@.str.10 = [32 x i8] c"\09Serial interface extension:%s\0A\00"
@.str.11 = [17 x i8] c"\09\09Unknown device\00"
@.str.12 = [12 x i8] c"\09\098250 UART\00"
@.str.13 = [13 x i8] c"\09\0916450 UART\00"
@.str.14 = [13 x i8] c"\09\0916550 UART\00"
@.str.15 = [21 x i8] c", Parity - %s%s%s%s\0A\00"
@.str.16 = [7 x i8] c"Space,\00"
@.str.17 = [6 x i8] c"Mark,\00"
@.str.18 = [5 x i8] c"Odd,\00"
@.str.19 = [5 x i8] c"Even\00"
@.str.20 = [41 x i8] c"\09\09Data bit - %s%s%s%s Stop bit - %s%s%s\0A\00"
@.str.21 = [6 x i8] c"5bit,\00"
@.str.22 = [6 x i8] c"6bit,\00"
@.str.23 = [6 x i8] c"7bit,\00"
@.str.24 = [6 x i8] c"8bit,\00"
@.str.25 = [6 x i8] c"1bit,\00"
@.str.26 = [8 x i8] c"1.5bit,\00"
@.str.27 = [5 x i8] c"2bit\00"
@.str.28 = [29 x i8] c"\09%s interface capabilities:\0A\00"
@.str.30 = [34 x i8] c"\09Fax%d/modem services available:\0A\00"
@str = [27 x i8] c"\09Voice services available:\00"
@str.33 = [32 x i8] c"\09Data modem services available:\00"
@str.34 = [41 x i8] c"\09Wrong length for serial extension tuple\00"
@reltable.dump_serial_ext = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.12 to i64), i64 ptrtoint ([3 x i32]* @reltable.dump_serial_ext to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.13 to i64), i64 ptrtoint ([3 x i32]* @reltable.dump_serial_ext to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.14 to i64), i64 ptrtoint ([3 x i32]* @reltable.dump_serial_ext to i64)) to i32)]
define void @dump_serial_ext(i32* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %78, label %4
4: ; preds = %2
%5 = load i32, i32* %0
switch i32 %5, label %78 [
i32 0, label %6
i32 8, label %6
i32 9, label %6
i32 10, label %6
i32 1, label %63
i32 5, label %63
i32 6, label %63
i32 7, label %63
i32 2, label %69
i32 19, label %71
i32 35, label %71
i32 51, label %71
i32 132, label %74
]
6: ; preds = %4, %4, %4, %4
%7 = zext i32 %5 to i64
%8 = getelementptr inbounds [11 x i8*], [11 x i8*]* @dump_serial_ext.type, i64 0, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i8* %9)
%11 = icmp ult i32 %1, 4
br i1 %11, label %76, label %12
12: ; preds = %6
%13 = getelementptr inbounds i32, i32* %0, i64 1
%14 = load i32, i32* %13
%15 = and i32 %14, 31
%16 = icmp ult i32 %15, 3
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = zext i32 %15 to i64
%19 = shl i64 %18, 2
%20 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.dump_serial_ext to i8*), i64 %19)
br label %21
21: ; preds = %17, %12
%22 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), %12 ], [ %20, %17 ]
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %22)
%24 = getelementptr inbounds i32, i32* %0, i64 2
%25 = load i32, i32* %24
%26 = and i32 %25, 1
%27 = icmp eq i32 %26, 0
%28 = select i1 %27, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0)
%29 = and i32 %25, 2
%30 = icmp eq i32 %29, 0
%31 = select i1 %30, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0)
%32 = and i32 %25, 4
%33 = icmp eq i32 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0)
%35 = and i32 %25, 8
%36 = icmp eq i32 %35, 0
%37 = select i1 %36, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* %28, i8* %31, i8* %34, i8* %37)
%39 = getelementptr inbounds i32, i32* %0, i64 3
%40 = load i32, i32* %39
%41 = and i32 %40, 1
%42 = icmp eq i32 %41, 0
%43 = select i1 %42, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0)
%44 = and i32 %40, 2
%45 = icmp eq i32 %44, 0
%46 = select i1 %45, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0)
%47 = and i32 %40, 4
%48 = icmp eq i32 %47, 0
%49 = select i1 %48, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.23, i64 0, i64 0)
%50 = and i32 %40, 8
%51 = icmp eq i32 %50, 0
%52 = select i1 %51, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i64 0, i64 0)
%53 = and i32 %40, 16
%54 = icmp eq i32 %53, 0
%55 = select i1 %54, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.25, i64 0, i64 0)
%56 = and i32 %40, 32
%57 = icmp eq i32 %56, 0
%58 = select i1 %57, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.26, i64 0, i64 0)
%59 = and i32 %40, 64
%60 = icmp eq i32 %59, 0
%61 = select i1 %60, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.27, i64 0, i64 0)
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.20, i64 0, i64 0), i8* %43, i8* %46, i8* %49, i8* %52, i8* %55, i8* %58, i8* %61)
br label %78
63: ; preds = %4, %4, %4, %4
%64 = zext i32 %5 to i64
%65 = getelementptr inbounds [11 x i8*], [11 x i8*]* @dump_serial_ext.type, i64 0, i64 %64
%66 = load i8*, i8** %65
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.28, i64 0, i64 0), i8* %66)
%68 = icmp ult i32 %1, 9
br i1 %68, label %76, label %78
69: ; preds = %4
%70 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.33, i64 0, i64 0))
br label %78
71: ; preds = %4, %4, %4
%72 = lshr i32 %5, 4
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.30, i64 0, i64 0), i32 %72)
br label %78
74: ; preds = %4
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %78
76: ; preds = %63, %6
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.34, i64 0, i64 0))
br label %78
78: ; preds = %63, %2, %76, %4, %74, %71, %69, %21
ret void
}