#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 */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ round_robin();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ shortest_job_first();
int main(void) {
  printf("1. Shortest job first\n");
  printf("2. Round robin\n");
  printf("> ");
  int choice;
  scanf("%d", &choice);
  switch (choice) {
  case 1:
    shortest_job_first();
    break;
  case 2:
    round_robin();
    break;
  default:
    printf("Invalid choice.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11a8 <main+0x68>
jmp    1197 <main+0x57>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11b4 <main+0x74>
jmp    11c0 <main+0x80>
mov    $0x0,%al
call   1060 <shortest_job_first@plt>
jmp    11cc <main+0x8c>
mov    $0x0,%al
call   1040 <round_robin@plt>
jmp    11cc <main+0x8c>
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
lea    0xe87(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     119d <main+0x4d>
cmp    $0x1,%eax
jne    11a6 <main+0x56>
xor    %eax,%eax
call   1070 <shortest_job_first@plt>
jmp    11b2 <main+0x62>
xor    %eax,%eax
call   1050 <round_robin@plt>
jmp    11b2 <main+0x62>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"1. Shortest job first\0A\00"
@.str.1 = [16 x i8] c"2. Round robin\0A\00"
@.str.2 = [3 x i8] c"> \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [17 x i8] c"Invalid choice.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
switch i32 %7, label %12 [
i32 1, label %8
i32 2, label %10
]
8: ; preds = %0
%9 = call i32 (...) @shortest_job_first()
br label %14
10: ; preds = %0
%11 = call i32 (...) @round_robin()
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"> \00"
@.str.3 = [3 x i8] c"%d\00"
@str = [22 x i8] c"1. Shortest job first\00"
@str.5 = [15 x i8] c"2. Round robin\00"
@str.6 = [16 x i8] c"Invalid choice.\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %12 [
i32 1, label %8
i32 2, label %10
]
8: ; preds = %0
%9 = call i32 (...) @shortest_job_first()
br label %14
10: ; preds = %0
%11 = call i32 (...) @round_robin()
br label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8
ret i32 0
}