void handleInterrupt21(int ax, int bx, int cx, int dx) {
  switch (ax) {
  case 0:
    printString(bx);
    break;
  case 1:
    readString(bx);
    break;
  case 2:
    readSector(bx, cx);
    break;
  default:
    printString("Error: What did you call it with?\r\n\0");
  }
}


x86 assembly (clang, -O0):
<handleInterrupt21>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1179 <handleInterrupt21+0x49>
jmp    1157 <handleInterrupt21+0x27>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1188 <handleInterrupt21+0x58>
jmp    1168 <handleInterrupt21+0x38>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1197 <handleInterrupt21+0x67>
jmp    11a9 <handleInterrupt21+0x79>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <printString@plt>
jmp    11b7 <handleInterrupt21+0x87>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <readString@plt>
jmp    11b7 <handleInterrupt21+0x87>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1050 <readSector@plt>
jmp    11b7 <handleInterrupt21+0x87>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printString@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleInterrupt21>:
cmp    $0x2,%edi
je     1147 <handleInterrupt21+0x17>
cmp    $0x1,%edi
je     1152 <handleInterrupt21+0x22>
test   %edi,%edi
jne    115b <handleInterrupt21+0x2b>
mov    %esi,%edi
xor    %eax,%eax
jmp    1030 <printString@plt>
mov    %esi,%edi
mov    %edx,%esi
xor    %eax,%eax
jmp    1050 <readSector@plt>
mov    %esi,%edi
xor    %eax,%eax
jmp    1040 <readString@plt>
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printString@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Error: What did you call it with?\0D\0A\00\00"
define void @handleInterrupt21(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
switch i32 %9, label %20 [
i32 0, label %10
i32 1, label %13
i32 2, label %16
]
10: ; preds = %4
%11 = load i32, i32* %6
%12 = call i32 (i32, ...) bitcast (i32 (...)* @printString to i32 (i32, ...)*)(i32 %11)
br label %22
13: ; preds = %4
%14 = load i32, i32* %6
%15 = call i32 (i32, ...) bitcast (i32 (...)* @readString to i32 (i32, ...)*)(i32 %14)
br label %22
16: ; preds = %4
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i32 (i32, i32, ...) bitcast (i32 (...)* @readSector to i32 (i32, i32, ...)*)(i32 %17, i32 %18)
br label %22
20: ; preds = %4
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @printString to i32 (i8*, ...)*)(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %16, %13, %10
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Error: What did you call it with?\0D\0A\00\00"
define void @handleInterrupt21(i32 %0, i32 %1, i32 %2, i32 %3) {
switch i32 %0, label %11 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
]
5: ; preds = %4
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @printString to i32 (i32, ...)*)(i32 %1)
br label %13
7: ; preds = %4
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @readString to i32 (i32, ...)*)(i32 %1)
br label %13
9: ; preds = %4
%10 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @readSector to i32 (i32, i32, ...)*)(i32 %1, i32 %2)
br label %13
11: ; preds = %4
%12 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printString to i32 (i8*, ...)*)(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %9, %7, %5
ret void
}