#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 */

/* Variables and functions */
scalar_t__ cmdcmp(int *, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ writeportb(int, int *, int);
int cmd_14(int fd, int *f, int size) {
  int empty[] = {20};
  int lo_3145[] = {20, 'l', 'o', ' ', '3', '1', '4', '5'};
  int cbf[] = {20, 'R', 'E', ' ', 'P', 'C', '_', 'C', 'B', 'U', 'F'};
  int cbf0[] = {20,  'w', 'r', ' ', 'P', 'C', '_', 'C',
                'B', 'U', 'F', '/', '0', ' ', '0'};
  int cbf1[] = {20,  'w', 'r', ' ', 'P', 'C', '_', 'C',
                'B', 'U', 'F', '/', '0', ' ', '1'};
  int cbf2[] = {20,  'w', 'r', ' ', 'P', 'C', '_', 'C',
                'B', 'U', 'F', '/', '1', ' ', '1', '5'};
  int cbf3[] = {20,  'w', 'r', ' ', 'P', 'C', '_', 'C',
                'B', 'U', 'F', '/', '1', ' ', '0'};
  int ipar[] = {20,  'w', 'r', ' ', 'I', 'P', 'A', 'R',
                '/', '0', '-', '9', '5', ' ', '0'};
  int ipb[] = {20,  'w', 'r', ' ', 'I', 'P', 'B',
               '/', '0', '-', '9', '5', ' ', '0'};
  int answer1[] = {170, 128, 4, 232, 66};
  int answer2[] = {170, 192, 2, 56, 93};
  int busy[] = {170, 64, 0, 230, 62};
  unsigned char resp[255];
  size -= 2;
  if ((size == 1) && (cmdcmp(f, empty, 1) == 0)) {
    printf("0x14: Empty cmd. Something wrong?\n");
  } else if ((size == 8) && (cmdcmp(f, lo_3145, 8)) == 0) {
    printf("0x14: lo 3145\n");
    writeportb(fd, busy, 5);
  } else if ((size == 11) && (cmdcmp(f, cbf, 11) == 0)) {
    printf("0x14: cbf. About to shut down?\n");
  } else if ((size == 15) && (cmdcmp(f, cbf0, 15) == 0)) {
    printf("0x14: cbf0. About to shut down?\n");
  } else if ((size == 15) && (cmdcmp(f, cbf1, 15) == 0)) {
    printf("0x14: cbf1.\n");
    writeportb(fd, answer2, 5);
  } else if ((size == 16) && (cmdcmp(f, cbf2, 16) == 0)) {
    printf("0x14: cbf2. Don't know what to answer\n");
  } else {
    printf("> Unknown 0x14 command: ");
    int i = 0;
    while (f[i] != 0) {
      if ((f[i] >= 32) && (f[i] <= 122))
        printf("'%c',", f[i++]);
      else
        printf("%i,", f[i++]);
    }
    printf("\n");
    printf("> size: %i\n", size);
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmd_14>:
push   %rbp
mov    %rsp,%rbp
sub    $0x360,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0xea5(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea5(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea2(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe9b(%rip),%rsi
mov    $0x2c,%edx
call   1050 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x3c,%edx
call   1050 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    0xedb(%rip),%rsi
mov    $0x3c,%edx
call   1050 <memcpy@plt>
lea    -0x130(%rbp),%rdi
lea    0xf03(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
lea    -0x170(%rbp),%rdi
lea    0xf2b(%rip),%rsi
mov    $0x3c,%edx
call   1050 <memcpy@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xf53(%rip),%rsi
mov    $0x3c,%edx
call   1050 <memcpy@plt>
lea    -0x1f0(%rbp),%rdi
lea    0xf7b(%rip),%rsi
mov    $0x38,%edx
call   1050 <memcpy@plt>
mov    0xfaa(%rip),%rax
mov    %rax,-0x210(%rbp)
mov    0xfa4(%rip),%rax
mov    %rax,-0x208(%rbp)
mov    0xf9f(%rip),%eax
mov    %eax,-0x200(%rbp)
mov    0xfa2(%rip),%rax
mov    %rax,-0x230(%rbp)
mov    0xf9c(%rip),%rax
mov    %rax,-0x228(%rbp)
mov    0xf97(%rip),%eax
mov    %eax,-0x220(%rbp)
mov    0xf9a(%rip),%rax
mov    %rax,-0x250(%rbp)
mov    0xf94(%rip),%rax
mov    %rax,-0x248(%rbp)
mov    0xf8f(%rip),%eax
mov    %eax,-0x240(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    12e9 <cmd_14+0x1a9>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1060 <cmdcmp@plt>
cmp    $0x0,%rax
jne    12e9 <cmd_14+0x1a9>
lea    0xf57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1522 <cmd_14+0x3e2>
cmpl   $0x8,-0x14(%rbp)
jne    1336 <cmd_14+0x1f6>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
call   1060 <cmdcmp@plt>
cmp    $0x0,%rax
jne    1336 <cmd_14+0x1f6>
lea    0xf41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
lea    -0x250(%rbp),%rsi
mov    $0x5,%edx
call   1030 <writeportb@plt>
jmp    151d <cmd_14+0x3dd>
cmpl   $0xb,-0x14(%rbp)
jne    136f <cmd_14+0x22f>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0xb,%edx
call   1060 <cmdcmp@plt>
cmp    $0x0,%rax
jne    136f <cmd_14+0x22f>
lea    0xf03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1518 <cmd_14+0x3d8>
cmpl   $0xf,-0x14(%rbp)
jne    13ab <cmd_14+0x26b>
mov    -0x10(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    $0xf,%edx
call   1060 <cmdcmp@plt>
cmp    $0x0,%rax
jne    13ab <cmd_14+0x26b>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1513 <cmd_14+0x3d3>
cmpl   $0xf,-0x14(%rbp)
jne    13fb <cmd_14+0x2bb>
mov    -0x10(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0xf,%edx
call   1060 <cmdcmp@plt>
cmp    $0x0,%rax
jne    13fb <cmd_14+0x2bb>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
lea    -0x230(%rbp),%rsi
mov    $0x5,%edx
call   1030 <writeportb@plt>
jmp    150e <cmd_14+0x3ce>
cmpl   $0x10,-0x14(%rbp)
jne    1437 <cmd_14+0x2f7>
mov    -0x10(%rbp),%rdi
lea    -0x130(%rbp),%rsi
mov    $0x10,%edx
call   1060 <cmdcmp@plt>
cmp    $0x0,%rax
jne    1437 <cmd_14+0x2f7>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1509 <cmd_14+0x3c9>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x354(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x354(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     14ea <cmd_14+0x3aa>
mov    -0x10(%rbp),%rax
movslq -0x354(%rbp),%rcx
cmpl   $0x20,(%rax,%rcx,4)
jl     14bc <cmd_14+0x37c>
mov    -0x10(%rbp),%rax
movslq -0x354(%rbp),%rcx
cmpl   $0x7a,(%rax,%rcx,4)
jg     14bc <cmd_14+0x37c>
mov    -0x10(%rbp),%rax
mov    -0x354(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x354(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14e5 <cmd_14+0x3a5>
mov    -0x10(%rbp),%rax
mov    -0x354(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x354(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    144f <cmd_14+0x30f>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    150e <cmd_14+0x3ce>
jmp    1513 <cmd_14+0x3d3>
jmp    1518 <cmd_14+0x3d8>
jmp    151d <cmd_14+0x3dd>
jmp    1522 <cmd_14+0x3e2>
xor    %eax,%eax
add    $0x360,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_14>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x168,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
movl   $0x14,0xc(%rsp)
movaps 0x100e(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xff2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movups 0xed2(%rip),%xmm0
movups %xmm0,0x8c(%rsp)
movaps 0xeb7(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movups 0xee8(%rip),%xmm0
movups %xmm0,0x10c(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xeae(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movups 0xeec(%rip),%xmm0
movups %xmm0,0xcc(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xe93(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xef4(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0xe97(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
mov    0xed9(%rip),%eax
mov    %eax,0x40(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0xee3(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    -0x3(%r14),%eax
cmp    $0xf,%eax
ja     13aa <cmd_14+0x25a>
mov    %edi,%ebp
lea    0xd5d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1070 <cmdcmp@plt>
test   %rax,%rax
jne    13aa <cmd_14+0x25a>
lea    0xf70(%rip),%rdi
call   1040 <puts@plt>
jmp    141c <cmd_14+0x2cc>
lea    0x50(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1070 <cmdcmp@plt>
test   %rax,%rax
jne    13aa <cmd_14+0x25a>
lea    0xf36(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
jmp    137b <cmd_14+0x22b>
lea    0x70(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xb,%edx
call   1070 <cmdcmp@plt>
test   %rax,%rax
jne    13aa <cmd_14+0x25a>
lea    0xee9(%rip),%rdi
call   1040 <puts@plt>
jmp    141c <cmd_14+0x2cc>
lea    0xe0(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xf,%edx
call   1070 <cmdcmp@plt>
test   %rax,%rax
je     142c <cmd_14+0x2dc>
lea    0xa0(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xf,%edx
call   1070 <cmdcmp@plt>
test   %rax,%rax
jne    13aa <cmd_14+0x25a>
lea    0xe74(%rip),%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%rsi
mov    %ebp,%edi
mov    $0x5,%edx
call   1050 <writeportb@plt>
jmp    141c <cmd_14+0x2cc>
lea    0x120(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
call   1070 <cmdcmp@plt>
test   %rax,%rax
je     143a <cmd_14+0x2ea>
add    $0xfffffffe,%r14d
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%esi
test   %esi,%esi
je     1401 <cmd_14+0x2b1>
add    $0x4,%rbx
lea    0xddc(%rip),%rbp
lea    0xddb(%rip),%r15
jmp    13f1 <cmd_14+0x2a1>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%esi
add    $0x4,%rbx
test   %esi,%esi
je     1401 <cmd_14+0x2b1>
lea    -0x20(%rsi),%eax
mov    %rbp,%rdi
cmp    $0x5b,%eax
jb     13e0 <cmd_14+0x290>
mov    %r15,%rdi
jmp    13e0 <cmd_14+0x290>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xda1(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdbe(%rip),%rdi
call   1040 <puts@plt>
jmp    141c <cmd_14+0x2cc>
lea    0xd7e(%rip),%rdi
call   1040 <puts@plt>
jmp    141c <cmd_14+0x2cc>

LLVM IR (-O0):
@__const.cmd_14.empty = [1 x i32] [i32 20]
@__const.cmd_14.lo_3145 = [8 x i32] [i32 20, i32 108, i32 111, i32 32, i32 51, i32 49, i32 52, i32 53]
@__const.cmd_14.cbf = [11 x i32] [i32 20, i32 82, i32 69, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70]
@__const.cmd_14.cbf0 = [15 x i32] [i32 20, i32 119, i32 114, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70, i32 47, i32 48, i32 32, i32 48]
@__const.cmd_14.cbf1 = [15 x i32] [i32 20, i32 119, i32 114, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70, i32 47, i32 48, i32 32, i32 49]
@__const.cmd_14.cbf2 = [16 x i32] [i32 20, i32 119, i32 114, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70, i32 47, i32 49, i32 32, i32 49, i32 53]
@__const.cmd_14.cbf3 = [15 x i32] [i32 20, i32 119, i32 114, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70, i32 47, i32 49, i32 32, i32 48]
@__const.cmd_14.ipar = [15 x i32] [i32 20, i32 119, i32 114, i32 32, i32 73, i32 80, i32 65, i32 82, i32 47, i32 48, i32 45, i32 57, i32 53, i32 32, i32 48]
@__const.cmd_14.ipb = [14 x i32] [i32 20, i32 119, i32 114, i32 32, i32 73, i32 80, i32 66, i32 47, i32 48, i32 45, i32 57, i32 53, i32 32, i32 48]
@__const.cmd_14.answer1 = [5 x i32] [i32 170, i32 128, i32 4, i32 232, i32 66]
@__const.cmd_14.answer2 = [5 x i32] [i32 170, i32 192, i32 2, i32 56, i32 93]
@__const.cmd_14.busy = [5 x i32] [i32 170, i32 64, i32 0, i32 230, i32 62]
@.str = [35 x i8] c"0x14: Empty cmd. Something wrong?\0A\00"
@.str.1 = [15 x i8] c"0x14: lo 3145\0A\00"
@.str.2 = [32 x i8] c"0x14: cbf. About to shut down?\0A\00"
@.str.3 = [33 x i8] c"0x14: cbf0. About to shut down?\0A\00"
@.str.4 = [13 x i8] c"0x14: cbf1.\0A\00"
@.str.5 = [39 x i8] c"0x14: cbf2. Don't know what to answer\0A\00"
@.str.6 = [25 x i8] c"> Unknown 0x14 command: \00"
@.str.7 = [6 x i8] c"'%c',\00"
@.str.8 = [4 x i8] c"%i,\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [12 x i8] c"> size: %i\0A\00"
define i32 @cmd_14(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca [1 x i32]
%8 = alloca [8 x i32]
%9 = alloca [11 x i32]
%10 = alloca [15 x i32]
%11 = alloca [15 x i32]
%12 = alloca [16 x i32]
%13 = alloca [15 x i32]
%14 = alloca [15 x i32]
%15 = alloca [14 x i32]
%16 = alloca [5 x i32]
%17 = alloca [5 x i32]
%18 = alloca [5 x i32]
%19 = alloca [255 x i8]
%20 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%21 = bitcast [1 x i32]* %7 to i8*
%22 = bitcast [8 x i32]* %8 to i8*
%23 = bitcast [11 x i32]* %9 to i8*
%24 = bitcast [15 x i32]* %10 to i8*
%25 = bitcast [15 x i32]* %11 to i8*
%26 = bitcast [16 x i32]* %12 to i8*
%27 = bitcast [15 x i32]* %13 to i8*
%28 = bitcast [15 x i32]* %14 to i8*
%29 = bitcast [14 x i32]* %15 to i8*
%30 = bitcast [5 x i32]* %16 to i8*
%31 = bitcast [5 x i32]* %17 to i8*
%32 = bitcast [5 x i32]* %18 to i8*
%33 = load i32, i32* %6
%34 = sub nsw i32 %33, 2
store i32 %34, i32* %6
%35 = load i32, i32* %6
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %44
37: ; preds = %3
%38 = load i32*, i32** %5
%39 = getelementptr inbounds [1 x i32], [1 x i32]* %7, i64 0, i64 0
%40 = call i64 @cmdcmp(i32* %38, i32* %39, i32 1)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %149
44: ; preds = %37, %3
%45 = load i32, i32* %6
%46 = icmp eq i32 %45, 8
br i1 %46, label %47, label %57
47: ; preds = %44
%48 = load i32*, i32** %5
%49 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%50 = call i64 @cmdcmp(i32* %48, i32* %49, i32 8)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %47
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%54 = load i32, i32* %4
%55 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 0
%56 = call i32 @writeportb(i32 %54, i32* %55, i32 5)
br label %148
57: ; preds = %47, %44
%58 = load i32, i32* %6
%59 = icmp eq i32 %58, 11
br i1 %59, label %60, label %67
60: ; preds = %57
%61 = load i32*, i32** %5
%62 = getelementptr inbounds [11 x i32], [11 x i32]* %9, i64 0, i64 0
%63 = call i64 @cmdcmp(i32* %61, i32* %62, i32 11)
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %60
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %147
67: ; preds = %60, %57
%68 = load i32, i32* %6
%69 = icmp eq i32 %68, 15
br i1 %69, label %70, label %77
70: ; preds = %67
%71 = load i32*, i32** %5
%72 = getelementptr inbounds [15 x i32], [15 x i32]* %10, i64 0, i64 0
%73 = call i64 @cmdcmp(i32* %71, i32* %72, i32 15)
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %70
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %146
77: ; preds = %70, %67
%78 = load i32, i32* %6
%79 = icmp eq i32 %78, 15
br i1 %79, label %80, label %90
80: ; preds = %77
%81 = load i32*, i32** %5
%82 = getelementptr inbounds [15 x i32], [15 x i32]* %11, i64 0, i64 0
%83 = call i64 @cmdcmp(i32* %81, i32* %82, i32 15)
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %90
85: ; preds = %80
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%87 = load i32, i32* %4
%88 = getelementptr inbounds [5 x i32], [5 x i32]* %17, i64 0, i64 0
%89 = call i32 @writeportb(i32 %87, i32* %88, i32 5)
br label %145
90: ; preds = %80, %77
%91 = load i32, i32* %6
%92 = icmp eq i32 %91, 16
br i1 %92, label %93, label %100
93: ; preds = %90
%94 = load i32*, i32** %5
%95 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 0
%96 = call i64 @cmdcmp(i32* %94, i32* %95, i32 16)
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %93
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %144
100: ; preds = %93, %90
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %20
br label %102
102: ; preds = %139, %100
%103 = load i32*, i32** %5
%104 = load i32, i32* %20
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i32, i32* %103, i64 %105
%107 = load i32, i32* %106
%108 = icmp ne i32 %107, 0
br i1 %108, label %109, label %140
109: ; preds = %102
%110 = load i32*, i32** %5
%111 = load i32, i32* %20
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %110, i64 %112
%114 = load i32, i32* %113
%115 = icmp sge i32 %114, 32
br i1 %115, label %116, label %131
116: ; preds = %109
%117 = load i32*, i32** %5
%118 = load i32, i32* %20
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i32, i32* %117, i64 %119
%121 = load i32, i32* %120
%122 = icmp sle i32 %121, 122
br i1 %122, label %123, label %131
123: ; preds = %116
%124 = load i32*, i32** %5
%125 = load i32, i32* %20
%126 = add nsw i32 %125, 1
store i32 %126, i32* %20
%127 = sext i32 %125 to i64
%128 = getelementptr inbounds i32, i32* %124, i64 %127
%129 = load i32, i32* %128
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %129)
br label %139
131: ; preds = %116, %109
%132 = load i32*, i32** %5
%133 = load i32, i32* %20
%134 = add nsw i32 %133, 1
store i32 %134, i32* %20
%135 = sext i32 %133 to i64
%136 = getelementptr inbounds i32, i32* %132, i64 %135
%137 = load i32, i32* %136
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %137)
br label %139
139: ; preds = %131, %123
br label %102
140: ; preds = %102
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%142 = load i32, i32* %6
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %142)
br label %144
144: ; preds = %140, %98
br label %145
145: ; preds = %144, %85
br label %146
146: ; preds = %145, %75
br label %147
147: ; preds = %146, %65
br label %148
148: ; preds = %147, %52
br label %149
149: ; preds = %148, %42
ret i32 0
}

LLVM IR (-O2):
@__const.cmd_14.lo_3145 = [8 x i32] [i32 20, i32 108, i32 111, i32 32, i32 51, i32 49, i32 52, i32 53]
@__const.cmd_14.cbf = [11 x i32] [i32 20, i32 82, i32 69, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70]
@__const.cmd_14.cbf0 = [15 x i32] [i32 20, i32 119, i32 114, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70, i32 47, i32 48, i32 32, i32 48]
@__const.cmd_14.cbf1 = [15 x i32] [i32 20, i32 119, i32 114, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70, i32 47, i32 48, i32 32, i32 49]
@__const.cmd_14.cbf2 = [16 x i32] [i32 20, i32 119, i32 114, i32 32, i32 80, i32 67, i32 95, i32 67, i32 66, i32 85, i32 70, i32 47, i32 49, i32 32, i32 49, i32 53]
@__const.cmd_14.answer2 = [5 x i32] [i32 170, i32 192, i32 2, i32 56, i32 93]
@__const.cmd_14.busy = [5 x i32] [i32 170, i32 64, i32 0, i32 230, i32 62]
@.str.6 = [25 x i8] c"> Unknown 0x14 command: \00"
@.str.7 = [6 x i8] c"'%c',\00"
@.str.8 = [4 x i8] c"%i,\00"
@.str.10 = [12 x i8] c"> size: %i\0A\00"
@str = [38 x i8] c"0x14: cbf2. Don't know what to answer\00"
@str.11 = [12 x i8] c"0x14: cbf1.\00"
@str.12 = [32 x i8] c"0x14: cbf0. About to shut down?\00"
@str.13 = [31 x i8] c"0x14: cbf. About to shut down?\00"
@str.14 = [14 x i8] c"0x14: lo 3145\00"
@str.15 = [34 x i8] c"0x14: Empty cmd. Something wrong?\00"
define i32 @cmd_14(i32 %0, i32* %1, i32 %2) {
%4 = alloca [1 x i32]
%5 = alloca [8 x i32]
%6 = alloca [11 x i32]
%7 = alloca [15 x i32]
%8 = alloca [15 x i32]
%9 = alloca [16 x i32]
%10 = alloca [5 x i32]
%11 = alloca [5 x i32]
%12 = bitcast [1 x i32]* %4 to i8*
%13 = getelementptr inbounds [1 x i32], [1 x i32]* %4, i64 0, i64 0
store i32 20, i32* %13
%14 = bitcast [8 x i32]* %5 to i8*
%15 = bitcast [11 x i32]* %6 to i8*
%16 = bitcast [15 x i32]* %7 to i8*
%17 = bitcast [15 x i32]* %8 to i8*
%18 = bitcast [16 x i32]* %9 to i8*
%19 = bitcast [5 x i32]* %10 to i8*
%20 = bitcast [5 x i32]* %11 to i8*
%21 = add nsw i32 %2, -2
switch i32 %2, label %61 [
i32 3, label %22
i32 10, label %27
i32 13, label %35
i32 17, label %41
i32 18, label %55
]
22: ; preds = %3
%23 = call i64 @cmdcmp(i32* %1, i32* %13, i32 1)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %61
25: ; preds = %22
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.15, i64 0, i64 0))
br label %79
27: ; preds = %3
%28 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%29 = call i64 @cmdcmp(i32* %1, i32* %28, i32 8)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %61
31: ; preds = %27
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.14, i64 0, i64 0))
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %11, i64 0, i64 0
%34 = call i32 @writeportb(i32 %0, i32* %33, i32 5)
br label %79
35: ; preds = %3
%36 = getelementptr inbounds [11 x i32], [11 x i32]* %6, i64 0, i64 0
%37 = call i64 @cmdcmp(i32* %1, i32* %36, i32 11)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %61
39: ; preds = %35
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.13, i64 0, i64 0))
br label %79
41: ; preds = %3
%42 = getelementptr inbounds [15 x i32], [15 x i32]* %7, i64 0, i64 0
%43 = call i64 @cmdcmp(i32* %1, i32* %42, i32 15)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.12, i64 0, i64 0))
br label %79
47: ; preds = %41
%48 = getelementptr inbounds [15 x i32], [15 x i32]* %8, i64 0, i64 0
%49 = call i64 @cmdcmp(i32* %1, i32* %48, i32 15)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %61
51: ; preds = %47
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0))
%53 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%54 = call i32 @writeportb(i32 %0, i32* %53, i32 5)
br label %79
55: ; preds = %3
%56 = getelementptr inbounds [16 x i32], [16 x i32]* %9, i64 0, i64 0
%57 = call i64 @cmdcmp(i32* %1, i32* %56, i32 16)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %55
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %79
61: ; preds = %3, %35, %22, %27, %47, %55
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%63 = load i32, i32* %1
%64 = icmp eq i32 %63, 0
br i1 %64, label %76, label %65
65: ; preds = %61, %65
%66 = phi i64 [ %72, %65 ], [ 0, %61 ]
%67 = phi i32 [ %74, %65 ], [ %63, %61 ]
%68 = add i32 %67, -32
%69 = icmp ult i32 %68, 91
%70 = select i1 %69, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %70, i32 %67)
%72 = add nuw i64 %66, 1
%73 = getelementptr inbounds i32, i32* %1, i64 %72
%74 = load i32, i32* %73
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %65
76: ; preds = %65, %61
%77 = call i32 @putchar(i32 10)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %21)
br label %79
79: ; preds = %31, %45, %59, %76, %51, %39, %25
ret i32 0
}