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);
    break;
  case 4:
    executeProgram(bx, cx);
    break;
  case 5:
    terminate();
    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    $0x5,%rax
ja     11f9 <handleInterrupt21+0x99>
mov    -0x48(%rbp),%rax
lea    0xe70(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <printString@plt>
jmp    1294 <handleInterrupt21+0x134>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <readString@plt>
jmp    1294 <handleInterrupt21+0x134>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1050 <readSector@plt>
jmp    1294 <handleInterrupt21+0x134>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1080 <readFile@plt>
jmp    1294 <handleInterrupt21+0x134>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <executeProgram@plt>
jmp    1294 <handleInterrupt21+0x134>
mov    $0x0,%al
call   1060 <terminate@plt>
jmp    1294 <handleInterrupt21+0x134>
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   1030 <printString@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleInterrupt21>:
sub    $0x28,%rsp
cmp    $0x5,%edi
ja     1188 <handleInterrupt21+0x28>
mov    %edi,%eax
lea    0xeae(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %esi,%edi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1030 <printString@plt>
movaps 0xe71(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xe76(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0xa0d3f,0x20(%rsp)
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <printString@plt>
add    $0x28,%rsp
ret
mov    %esi,%edi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1040 <readString@plt>
mov    %esi,%edi
mov    %edx,%esi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1050 <readSector@plt>
mov    %esi,%edi
mov    %edx,%esi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1080 <readFile@plt>
mov    %esi,%edi
mov    %edx,%esi
xor    %eax,%eax
add    $0x28,%rsp
jmp    1070 <executeProgram@plt>
xor    %eax,%eax
add    $0x28,%rsp
jmp    1060 <terminate@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 %31 [
i32 0, label %11
i32 1, label %14
i32 2, label %17
i32 3, label %21
i32 4, label %25
i32 5, label %29
]
11: ; preds = %4
%12 = load i32, i32* %6
%13 = call i32 (i32, ...) bitcast (i32 (...)* @printString to i32 (i32, ...)*)(i32 %12)
br label %70
14: ; preds = %4
%15 = load i32, i32* %6
%16 = call i32 (i32, ...) bitcast (i32 (...)* @readString to i32 (i32, ...)*)(i32 %15)
br label %70
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 %70
21: ; preds = %4
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = call i32 (i32, i32, ...) bitcast (i32 (...)* @readFile to i32 (i32, i32, ...)*)(i32 %22, i32 %23)
br label %70
25: ; preds = %4
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 (i32, i32, ...) bitcast (i32 (...)* @executeProgram to i32 (i32, i32, ...)*)(i32 %26, i32 %27)
br label %70
29: ; preds = %4
%30 = call i32 (...) @terminate()
br label %70
31: ; preds = %4
%32 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 0
store i8 69, i8* %32
%33 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 1
store i8 114, i8* %33
%34 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 2
store i8 114, i8* %34
%35 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 3
store i8 111, i8* %35
%36 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 4
store i8 114, i8* %36
%37 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 5
store i8 58, i8* %37
%38 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 6
store i8 32, i8* %38
%39 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 7
store i8 119, i8* %39
%40 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 8
store i8 104, i8* %40
%41 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 9
store i8 97, i8* %41
%42 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 10
store i8 116, i8* %42
%43 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 11
store i8 32, i8* %43
%44 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 12
store i8 100, i8* %44
%45 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 13
store i8 105, i8* %45
%46 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 14
store i8 100, i8* %46
%47 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 15
store i8 32, i8* %47
%48 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 16
store i8 121, i8* %48
%49 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 17
store i8 111, i8* %49
%50 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 18
store i8 117, i8* %50
%51 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 19
store i8 32, i8* %51
%52 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 20
store i8 99, i8* %52
%53 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 21
store i8 97, i8* %53
%54 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 22
store i8 108, i8* %54
%55 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 23
store i8 108, i8* %55
%56 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 24
store i8 32, i8* %56
%57 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 25
store i8 105, i8* %57
%58 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 26
store i8 116, i8* %58
%59 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 27
store i8 32, i8* %59
%60 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 28
store i8 119, i8* %60
%61 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 29
store i8 105, i8* %61
%62 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 30
store i8 116, i8* %62
%63 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 31
store i8 104, i8* %63
%64 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 32
store i8 63, i8* %64
%65 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 33
store i8 13, i8* %65
%66 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 34
store i8 10, i8* %66
%67 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 35
store i8 0, i8* %67
%68 = getelementptr inbounds [36 x i8], [36 x i8]* %9, i64 0, i64 0
%69 = call i32 (i8*, ...) bitcast (i32 (...)* @printString to i32 (i8*, ...)*)(i8* %68)
br label %70
70: ; preds = %31, %29, %25, %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 %19 [
i32 0, label %7
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
]
7: ; preds = %4
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @printString to i32 (i32, ...)*)(i32 %1)
br label %28
9: ; preds = %4
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @readString to i32 (i32, ...)*)(i32 %1)
br label %28
11: ; preds = %4
%12 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @readSector to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
br label %28
13: ; preds = %4
%14 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @readFile to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
br label %28
15: ; preds = %4
%16 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @executeProgram to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
br label %28
17: ; preds = %4
%18 = tail call i32 (...) @terminate()
br label %28
19: ; preds = %4
%20 = 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>* %20
%21 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 16
%22 = bitcast i8* %21 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>* %22
%23 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 32
store i8 63, i8* %23
%24 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 33
store i8 13, i8* %24
%25 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 34
store i8 10, i8* %25
%26 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 35
store i8 0, i8* %26
%27 = call i32 (i8*, ...) bitcast (i32 (...)* @printString to i32 (i8*, ...)*)(i8* %6)
br label %28
28: ; preds = %19, %17, %15, %13, %11, %9, %7
ret void
}