void handleInterrupt21(int ax, int bx, int cx, int dx) {
  char errorMsg[36];
  switch (ax) {
  case 0:
    printString(bx);
    break;
  case 1:
    readString(bx);
    break;
  case 2:
    readSector(bx, cx);
    break;
  case 3:
    readFile(bx, cx, dx);
    break;
  case 4:
    executeProgram(bx, cx);
    break;
  case 5:
    terminate();
    break;
  case 6:
    writeSector(bx, cx);
    break;
  case 7:
    deleteFile(bx);
    break;
  case 8:
    writeFile(bx, cx, dx);
    break;
  case 9:
    listFile();
    break;
  case 99:
    countFileSectors(bx, cx);
    break;
  default:
    errorMsg[0] = 'E';
    errorMsg[1] = 'r';
    errorMsg[2] = 'r';
    errorMsg[3] = 'o';
    errorMsg[4] = 'r';
    errorMsg[5] = ':';
    errorMsg[6] = ' ';
    errorMsg[7] = 'w';
    errorMsg[8] = 'h';
    errorMsg[9] = 'a';
    errorMsg[10] = 't';
    errorMsg[11] = ' ';
    errorMsg[12] = 'd';
    errorMsg[13] = 'i';
    errorMsg[14] = 'd';
    errorMsg[15] = ' ';
    errorMsg[16] = 'y';
    errorMsg[17] = 'o';
    errorMsg[18] = 'u';
    errorMsg[19] = ' ';
    errorMsg[20] = 'c';
    errorMsg[21] = 'a';
    errorMsg[22] = 'l';
    errorMsg[23] = 'l';
    errorMsg[24] = ' ';
    errorMsg[25] = 'i';
    errorMsg[26] = 't';
    errorMsg[27] = ' ';
    errorMsg[28] = 'w';
    errorMsg[29] = 'i';
    errorMsg[30] = 't';
    errorMsg[31] = 'h';
    errorMsg[32] = '?';
    errorMsg[33] = '\r';
    errorMsg[34] = '\n';
    errorMsg[35] = '\0';
    printString(errorMsg);
  }
}


x86 assembly (clang, -O0):
<handleInterrupt21>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x48(%rbp)
sub    $0x63,%rax
ja     12a0 <handleInterrupt21+0xf0>
mov    -0x48(%rbp),%rax
lea    0xe20(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1060 <printString@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1090 <readString@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   10a0 <readSector@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    $0x0,%al
call   10d0 <readFile@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   10c0 <executeProgram@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    $0x0,%al
call   10b0 <terminate@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1040 <writeSector@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1070 <deleteFile@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    $0x0,%al
call   1080 <writeFile@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    $0x0,%al
call   1030 <listFile@plt>
jmp    133b <handleInterrupt21+0x18b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1050 <countFileSectors@plt>
jmp    133b <handleInterrupt21+0x18b>
movb   $0x45,-0x40(%rbp)
movb   $0x72,-0x3f(%rbp)
movb   $0x72,-0x3e(%rbp)
movb   $0x6f,-0x3d(%rbp)
movb   $0x72,-0x3c(%rbp)
movb   $0x3a,-0x3b(%rbp)
movb   $0x20,-0x3a(%rbp)
movb   $0x77,-0x39(%rbp)
movb   $0x68,-0x38(%rbp)
movb   $0x61,-0x37(%rbp)
movb   $0x74,-0x36(%rbp)
movb   $0x20,-0x35(%rbp)
movb   $0x64,-0x34(%rbp)
movb   $0x69,-0x33(%rbp)
movb   $0x64,-0x32(%rbp)
movb   $0x20,-0x31(%rbp)
movb   $0x79,-0x30(%rbp)
movb   $0x6f,-0x2f(%rbp)
movb   $0x75,-0x2e(%rbp)
movb   $0x20,-0x2d(%rbp)
movb   $0x63,-0x2c(%rbp)
movb   $0x61,-0x2b(%rbp)
movb   $0x6c,-0x2a(%rbp)
movb   $0x6c,-0x29(%rbp)
movb   $0x20,-0x28(%rbp)
movb   $0x69,-0x27(%rbp)
movb   $0x74,-0x26(%rbp)
movb   $0x20,-0x25(%rbp)
movb   $0x77,-0x24(%rbp)
movb   $0x69,-0x23(%rbp)
movb   $0x74,-0x22(%rbp)
movb   $0x68,-0x21(%rbp)
movb   $0x3f,-0x20(%rbp)
movb   $0xd,-0x1f(%rbp)
movb   $0xa,-0x1e(%rbp)
movb   $0x0,-0x1d(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1060 <printString@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleInterrupt21>:
sub    $0x28,%rsp
cmp    $0x63,%edi
ja     125b <handleInterrupt21+0xab>
mov    %edi,%eax
lea    0xe5a(%rip),%rdi
movslq (%rdi,%rax,4),%rax
add    %rdi,%rax
jmp    *%rax
mov    %esi,%edi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1060 <printString@plt>
mov    %esi,%edi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1090 <readString@plt>
mov    %esi,%edi
mov    %edx,%esi
xor    %eax,%eax
add    $0x28,%rsp
jmp    10a0 <readSector@plt>
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
xor    %eax,%eax
add    $0x28,%rsp
jmp    10d0 <readFile@plt>
mov    %esi,%edi
mov    %edx,%esi
xor    %eax,%eax
add    $0x28,%rsp
jmp    10c0 <executeProgram@plt>
xor    %eax,%eax
add    $0x28,%rsp
jmp    10b0 <terminate@plt>
mov    %esi,%edi
mov    %edx,%esi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1040 <writeSector@plt>
mov    %esi,%edi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1070 <deleteFile@plt>
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
xor    %eax,%eax
add    $0x28,%rsp
jmp    1080 <writeFile@plt>
xor    %eax,%eax
add    $0x28,%rsp
jmp    1030 <listFile@plt>
movaps 0xd9e(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xda3(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0xa0d3f,0x20(%rsp)
mov    %rsp,%rdi
xor    %eax,%eax
call   1060 <printString@plt>
add    $0x28,%rsp
ret
mov    %esi,%edi
mov    %edx,%esi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1050 <countFileSectors@plt>

LLVM IR (-O0):
define void @handleInterrupt21(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [36 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
switch i32 %10, label %50 [
i32 0, label %11
i32 1, label %14
i32 2, label %17
i32 3, label %21
i32 4, label %26
i32 5, label %30
i32 6, label %32
i32 7, label %36
i32 8, label %39
i32 9, label %44
i32 99, label %46
]
11: ; preds = %4
%12 = load i32, i32* %6
%13 = call i32 (i32, ...) bitcast (i32 (...)* @printString to i32 (i32, ...)*)(i32 %12)
br label %89
14: ; preds = %4
%15 = load i32, i32* %6
%16 = call i32 (i32, ...) bitcast (i32 (...)* @readString to i32 (i32, ...)*)(i32 %15)
br label %89
17: ; preds = %4
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 (i32, i32, ...) bitcast (i32 (...)* @readSector to i32 (i32, i32, ...)*)(i32 %18, i32 %19)
br label %89
21: ; preds = %4
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @readFile to i32 (i32, i32, i32, ...)*)(i32 %22, i32 %23, i32 %24)
br label %89
26: ; preds = %4
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = call i32 (i32, i32, ...) bitcast (i32 (...)* @executeProgram to i32 (i32, i32, ...)*)(i32 %27, i32 %28)
br label %89
30: ; preds = %4
%31 = call i32 (...) @terminate()
br label %89
32: ; preds = %4
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = call i32 (i32, i32, ...) bitcast (i32 (...)* @writeSector to i32 (i32, i32, ...)*)(i32 %33, i32 %34)
br label %89
36: ; preds = %4
%37 = load i32, i32* %6
%38 = call i32 (i32, ...) bitcast (i32 (...)* @deleteFile to i32 (i32, ...)*)(i32 %37)
br label %89
39: ; preds = %4
%40 = load i32, i32* %6
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @writeFile to i32 (i32, i32, i32, ...)*)(i32 %40, i32 %41, i32 %42)
br label %89
44: ; preds = %4
%45 = call i32 (...) @listFile()
br label %89
46: ; preds = %4
%47 = load i32, i32* %6
%48 = load i32, i32* %7
%49 = call i32 (i32, i32, ...) bitcast (i32 (...)* @countFileSectors to i32 (i32, i32, ...)*)(i32 %47, i32 %48)
br label %89
50: ; preds = %4
%51 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 0
store i8 69, i8* %51
%52 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 1
store i8 114, i8* %52
%53 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 2
store i8 114, i8* %53
%54 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 3
store i8 111, i8* %54
%55 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 4
store i8 114, i8* %55
%56 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 5
store i8 58, i8* %56
%57 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 6
store i8 32, i8* %57
%58 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 7
store i8 119, i8* %58
%59 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 8
store i8 104, i8* %59
%60 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 9
store i8 97, i8* %60
%61 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 10
store i8 116, i8* %61
%62 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 11
store i8 32, i8* %62
%63 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 12
store i8 100, i8* %63
%64 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 13
store i8 105, i8* %64
%65 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 14
store i8 100, i8* %65
%66 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 15
store i8 32, i8* %66
%67 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 16
store i8 121, i8* %67
%68 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 17
store i8 111, i8* %68
%69 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 18
store i8 117, i8* %69
%70 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 19
store i8 32, i8* %70
%71 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 20
store i8 99, i8* %71
%72 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 21
store i8 97, i8* %72
%73 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 22
store i8 108, i8* %73
%74 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 23
store i8 108, i8* %74
%75 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 24
store i8 32, i8* %75
%76 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 25
store i8 105, i8* %76
%77 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 26
store i8 116, i8* %77
%78 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 27
store i8 32, i8* %78
%79 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 28
store i8 119, i8* %79
%80 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 29
store i8 105, i8* %80
%81 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 30
store i8 116, i8* %81
%82 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 31
store i8 104, i8* %82
%83 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 32
store i8 63, i8* %83
%84 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 33
store i8 13, i8* %84
%85 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 34
store i8 10, i8* %85
%86 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 35
store i8 0, i8* %86
%87 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 0
%88 = call i32 (i8*, ...) bitcast (i32 (...)* @printString to i32 (i8*, ...)*)(i8* %87)
br label %89
89: ; preds = %50, %46, %44, %39, %36, %32, %30, %26, %21, %17, %14, %11
ret void
}

LLVM IR (-O2):
define void @handleInterrupt21(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [36 x i8]
%6 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 0
switch i32 %0, label %29 [
i32 0, label %7
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
i32 6, label %19
i32 7, label %21
i32 8, label %23
i32 9, label %25
i32 99, label %27
]
7: ; preds = %4
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @printString to i32 (i32, ...)*)(i32 %1)
br label %38
9: ; preds = %4
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @readString to i32 (i32, ...)*)(i32 %1)
br label %38
11: ; preds = %4
%12 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @readSector to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
br label %38
13: ; preds = %4
%14 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @readFile to i32 (i32, i32, i32, ...)*)(i32 %1, i32 %2, i32 %3)
br label %38
15: ; preds = %4
%16 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @executeProgram to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
br label %38
17: ; preds = %4
%18 = tail call i32 (...) @terminate()
br label %38
19: ; preds = %4
%20 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @writeSector to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
br label %38
21: ; preds = %4
%22 = tail call i32 (i32, ...) bitcast (i32 (...)* @deleteFile to i32 (i32, ...)*)(i32 %1)
br label %38
23: ; preds = %4
%24 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @writeFile to i32 (i32, i32, i32, ...)*)(i32 %1, i32 %2, i32 %3)
br label %38
25: ; preds = %4
%26 = tail call i32 (...) @listFile()
br label %38
27: ; preds = %4
%28 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @countFileSectors to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
br label %38
29: ; preds = %4
%30 = bitcast [36 x i8]* %5 to <16 x i8>*
store <16 x i8> <i8 69, i8 114, i8 114, i8 111, i8 114, i8 58, i8 32, i8 119, i8 104, i8 97, i8 116, i8 32, i8 100, i8 105, i8 100, i8 32>, <16 x i8>* %30
%31 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 16
%32 = bitcast i8* %31 to <16 x i8>*
store <16 x i8> <i8 121, i8 111, i8 117, i8 32, i8 99, i8 97, i8 108, i8 108, i8 32, i8 105, i8 116, i8 32, i8 119, i8 105, i8 116, i8 104>, <16 x i8>* %32
%33 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 32
store i8 63, i8* %33
%34 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 33
store i8 13, i8* %34
%35 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 34
store i8 10, i8* %35
%36 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 35
store i8 0, i8* %36
%37 = call i32 (i8*, ...) bitcast (i32 (...)* @printString to i32 (i8*, ...)*)(i8* %6)
br label %38
38: ; preds = %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7
ret void
}