#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ round_robin();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sjf();
void main() {
  int ch;
  printf("\nSelect type of scheduling\n1. SJF\n2. RR\n3. EXIT\n\nEnter your "
         "choice: ");
  scanf("%d", &ch);
  switch (ch) {
  case 1:
    sjf();
    break;
  case 2:
    round_robin();
    break;
  case 3:
    exit(0);
    break;
  default:
    printf("Invalid choice!!\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     11aa <main+0x5a>
jmp    1188 <main+0x38>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11b6 <main+0x66>
jmp    1199 <main+0x49>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     11c2 <main+0x72>
jmp    11c9 <main+0x79>
mov    $0x0,%al
call   1060 <sjf@plt>
jmp    11d5 <main+0x85>
mov    $0x0,%al
call   1040 <round_robin@plt>
jmp    11d5 <main+0x85>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     119f <main+0x3f>
cmp    $0x2,%eax
je     11a8 <main+0x48>
cmp    $0x3,%eax
je     11b1 <main+0x51>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret
xor    %eax,%eax
call   1070 <sjf@plt>
pop    %rax
ret
xor    %eax,%eax
call   1050 <round_robin@plt>
pop    %rax
ret
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [69 x i8] c"\0ASelect type of scheduling\0A1. SJF\0A2. RR\0A3. EXIT\0A\0AEnter your choice: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Invalid choice!!\0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
switch i32 %4, label %11 [
i32 1, label %5
i32 2, label %7
i32 3, label %9
]
5: ; preds = %0
%6 = call i32 (...) @sjf()
br label %13
7: ; preds = %0
%8 = call i32 (...) @round_robin()
br label %13
9: ; preds = %0
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %7, %5
ret void
}

LLVM IR (-O2):
@.str = [69 x i8] c"\0ASelect type of scheduling\0A1. SJF\0A2. RR\0A3. EXIT\0A\0AEnter your choice: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [17 x i8] c"Invalid choice!!\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %12 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
]
6: ; preds = %0
%7 = call i32 (...) @sjf()
br label %14
8: ; preds = %0
%9 = call i32 (...) @round_robin()
br label %14
10: ; preds = %0
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %12, %8, %6
ret void
}