#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*/ scanf(char *, ...);
int main() {
  int n, i, j, max = 0, key, key1, tot, complete;
  float tt = 0.0, wt = 0.0;
  char key2;
  printf("enter no. of process: ");
  scanf("%d", &n);
  struct process {
    char name[10];
    int arr_time;
    int burst_time;
  };
  struct scheduling {
    int waiting_time;
    int turn_arrnd_time;
  };
  struct process p[n];
  struct scheduling result[n];
  for (i = 0; i < n; i++) {
    printf("Enter Process Name,Arrival time and Burst Time :");
    scanf("%s%d%d", p[i].name, &p[i].arr_time, &p[i].burst_time);
  }
  printf("\n\n");
  for (i = 1; i < n; i++) {
    key = p[i].arr_time;
    key1 = p[i].burst_time;
    key2 = p[i].name[1];
    j = i - 1;
    while (j >= 0 && key < p[j].arr_time) {
      p[j + 1].arr_time = p[j].arr_time;
      p[j + 1].burst_time = p[j].burst_time;
      p[j + 1].name[1] = p[j].name[1];
      j--;
    }
    p[j + 1].arr_time = key;
    p[j + 1].burst_time = key1;
    p[j + 1].name[1] = key2;
  }
  tot = p[0].arr_time;
  for (i = 0; i < n; i++) {
    result[i].waiting_time = tot - p[i].arr_time;
    result[i].turn_arrnd_time = result[i].waiting_time + p[i].burst_time;
    tot = tot + p[i].burst_time;
    wt = wt + result[i].waiting_time;
    tt = tt + result[i].turn_arrnd_time;
  }
  tt = tt / (n * 1.0);
  wt = wt / (n * 1.0);
  printf("Process Name  arrival_time  burst_time  waiting_time  turn around "
         "time\n");
  for (i = 0; i < n; i++) {
    printf("%c%c\t\t %d\t\t %d\t\t %d\t\t %d\t\t\n", p[i].name[0], p[i].name[1],
           p[i].arr_time, p[i].burst_time, result[i].waiting_time,
           result[i].turn_arrnd_time);
  }
  printf("\n\n");
  printf("Average Waiting Time: %f\nAverage Turn Around Time: %f", wt, tt);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xebd(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x59(%rbp)
call   1030 <printf@plt>
mov    -0x59(%rbp),%al
lea    0xef5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    (%rax,%rax,4),%rcx
lea    0xf(,%rcx,4),%rdx
movabs $0x3ffffffff0,%rcx
and    %rcx,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122c <main+0x10c>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%rcx
movslq -0xc(%rbp),%rax
imul   $0x14,%rax,%rax
mov    %rcx,%rsi
add    %rax,%rsi
movslq -0xc(%rbp),%rax
imul   $0x14,%rax,%rax
mov    %rcx,%rdx
add    %rax,%rdx
add    $0xc,%rdx
movslq -0xc(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rcx
add    $0x10,%rcx
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c3 <main+0xa3>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13ab <main+0x28b>
mov    -0x58(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
mov    0xc(%rcx),%ecx
mov    %ecx,-0x18(%rbp)
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
mov    0x10(%rcx),%ecx
mov    %ecx,-0x1c(%rbp)
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
mov    0x1(%rax),%al
mov    %al,-0x2d(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x5a(%rbp)
jl     12bd <main+0x19d>
mov    -0x58(%rbp),%rcx
mov    -0x18(%rbp),%eax
movslq -0x10(%rbp),%rdx
imul   $0x14,%rdx,%rdx
add    %rdx,%rcx
cmp    0xc(%rcx),%eax
setl   %al
mov    %al,-0x5a(%rbp)
mov    -0x5a(%rbp),%al
test   $0x1,%al
jne    12cd <main+0x1ad>
jmp    1351 <main+0x231>
mov    -0x58(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x14,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
mov    0xc(%rcx),%edx
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x14,%rcx,%rsi
mov    %rax,%rcx
add    %rsi,%rcx
mov    %edx,0xc(%rcx)
movslq -0x10(%rbp),%rcx
imul   $0x14,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
mov    0x10(%rcx),%edx
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x14,%rcx,%rsi
mov    %rax,%rcx
add    %rsi,%rcx
mov    %edx,0x10(%rcx)
movslq -0x10(%rbp),%rcx
imul   $0x14,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
mov    0x1(%rcx),%cl
mov    -0x10(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   $0x14,%rdx,%rdx
add    %rdx,%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1293 <main+0x173>
mov    -0x58(%rbp),%rax
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x14,%rcx,%rsi
mov    %rax,%rcx
add    %rsi,%rcx
mov    %edx,0xc(%rcx)
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   $0x14,%rcx,%rsi
mov    %rax,%rcx
add    %rsi,%rcx
mov    %edx,0x10(%rcx)
mov    -0x2d(%rbp),%cl
mov    -0x10(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
imul   $0x14,%rdx,%rdx
add    %rdx,%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1241 <main+0x121>
mov    -0x58(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    145c <main+0x33c>
mov    -0x50(%rbp),%rax
mov    -0x58(%rbp),%rdx
mov    -0x20(%rbp),%esi
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rdi
mov    %rdx,%rcx
add    %rdi,%rcx
sub    0xc(%rcx),%esi
movslq -0xc(%rbp),%rcx
mov    %esi,(%rax,%rcx,8)
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%esi
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rdi
mov    %rdx,%rcx
add    %rdi,%rcx
add    0x10(%rcx),%esi
movslq -0xc(%rbp),%rcx
mov    %esi,0x4(%rax,%rcx,8)
mov    -0x20(%rbp),%ecx
movslq -0xc(%rbp),%rsi
imul   $0x14,%rsi,%rsi
add    %rsi,%rdx
add    0x10(%rdx),%ecx
mov    %ecx,-0x20(%rbp)
movss  -0x2c(%rbp),%xmm0
movslq -0xc(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,8),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x28(%rbp),%xmm0
movslq -0xc(%rbp),%rcx
cvtsi2ssl 0x4(%rax,%rcx,8),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    13bc <main+0x29c>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xb8e(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xb67(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
lea    0xba9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    154d <main+0x42d>
mov    -0x50(%rbp),%rax
mov    -0x58(%rbp),%rdi
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rdx
mov    %rdi,%rcx
add    %rdx,%rcx
movsbl (%rcx),%esi
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rdx
mov    %rdi,%rcx
add    %rdx,%rcx
movsbl 0x1(%rcx),%edx
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%r8
mov    %rdi,%rcx
add    %r8,%rcx
mov    0xc(%rcx),%ecx
movslq -0xc(%rbp),%r8
imul   $0x14,%r8,%r8
add    %r8,%rdi
mov    0x10(%rdi),%r8d
movslq -0xc(%rbp),%rdi
mov    (%rax,%rdi,8),%r9d
movslq -0xc(%rbp),%rdi
mov    0x4(%rax,%rdi,8),%eax
lea    0xb75(%rip),%rdi
sub    $0x10,%rsp
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    14bf <main+0x39f>
lea    0xb03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xb4a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef6(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rsp,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
lea    (%rax,%rax,4),%rax
lea    0xf(,%rax,4),%rax
movabs $0x3ffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%r13
sub    %rcx,%r13
mov    %r13,%rsp
mov    -0x2c(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r12
mov    %r12,%rsp
test   %eax,%eax
jle    11f4 <main+0xc4>
lea    0xe9b(%rip),%r15
mov    %r13,%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe50(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rbx),%rdx
lea    0x10(%rbx),%rcx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%r14
movslq -0x2c(%rbp),%rax
add    $0x14,%rbx
cmp    %rax,%r14
jl     11c0 <main+0x90>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
mov    -0x2c(%rbp),%r8d
cmp    $0x2,%r8d
jl     129b <main+0x16b>
lea    0x24(%r13),%r11
mov    $0x1,%r14d
jmp    1243 <main+0x113>
nopw   0x0(%rax,%rax,1)
movslq %esi,%rcx
lea    (%rcx,%rcx,4),%rcx
mov    %eax,0xc(%r13,%rcx,4)
mov    %r9d,0x10(%r13,%rcx,4)
mov    %r10b,0x1(%r13,%rcx,4)
add    $0x1,%r14
add    $0x14,%r11
cmp    %r8,%r14
je     129b <main+0x16b>
lea    (%r14,%r14,4),%rcx
mov    0xc(%r13,%rcx,4),%eax
mov    0x10(%r13,%rcx,4),%r9d
mov    0x1(%r13,%rcx,4),%r10b
mov    %r11,%rcx
mov    %r14,%rdx
nopl   0x0(%rax)
mov    %rdx,%rsi
add    $0xffffffffffffffff,%rdx
mov    %edx,%edi
lea    (%rdi,%rdi,4),%rdi
mov    0xc(%r13,%rdi,4),%ebx
cmp    %ebx,%eax
jge    1220 <main+0xf0>
mov    %ebx,-0x4(%rcx)
mov    0x10(%r13,%rdi,4),%esi
mov    %esi,(%rcx)
movzbl 0x1(%r13,%rdi,4),%ebx
mov    %bl,-0xf(%rcx)
lea    0x1(%rdx),%rsi
add    $0xffffffffffffffec,%rcx
cmp    $0x1,%rsi
jg     1260 <main+0x130>
xor    %esi,%esi
jmp    1220 <main+0xf0>
test   %r8d,%r8d
jle    131d <main+0x1ed>
mov    0xc(%r13),%ecx
mov    0x10(%r13),%edx
cvtsi2ss %edx,%xmm0
movl   $0x0,(%r12)
mov    %edx,0x4(%r12)
xorps  %xmm1,%xmm1
cmp    $0x1,%r8d
je     130d <main+0x1dd>
lea    -0x1(%r8),%r9
lea    0x24(%r13),%rdi
xorps  %xmm1,%xmm1
xor    %eax,%eax
nop
add    %edx,%ecx
mov    %ecx,%ebx
sub    -0x4(%rdi),%ebx
mov    %ebx,0x8(%r12,%rax,8)
mov    (%rdi),%edx
lea    (%rdx,%rbx,1),%esi
mov    %esi,0xc(%r12,%rax,8)
xorps  %xmm2,%xmm2
cvtsi2ss %ebx,%xmm2
addss  %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtsi2ss %esi,%xmm2
addss  %xmm2,%xmm0
add    $0x1,%rax
add    $0x14,%rdi
cmp    %rax,%r9
jne    12d0 <main+0x1a0>
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,-0x38(%rbp)
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    132d <main+0x1fd>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
cvtsi2sd %r8d,%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    0xd60(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    139f <main+0x26f>
lea    0xcfc(%rip),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
movsbl 0x0(%r13),%esi
movsbl 0x1(%r13),%edx
mov    0xc(%r13),%ecx
mov    0x10(%r13),%r8d
mov    (%r12,%r15,8),%r9d
mov    0x4(%r12,%r15,8),%ebx
sub    $0x8,%rsp
mov    %r14,%rdi
xor    %eax,%eax
push   %rbx
call   1040 <printf@plt>
add    $0x10,%rsp
add    $0x1,%r15
movslq -0x2c(%rbp),%rax
add    $0x14,%r13
cmp    %rax,%r15
jl     1360 <main+0x230>
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
lea    0xc9a(%rip),%rdi
call   1030 <puts@plt>
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x40(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xc7e(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x50(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.process = type { [10 x i8], i32, i32 }
%struct.scheduling = type { i32, i32 }
@.str = [23 x i8] c"enter no. of process: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [49 x i8] c"Enter Process Name,Arrival time and Burst Time :\00"
@.str.3 = [7 x i8] c"%s%d%d\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
@.str.5 = [72 x i8] c"Process Name arrival_time burst_time waiting_time turn around time\0A\00"
@.str.6 = [28 x i8] c"%c%c\09\09 %d\09\09 %d\09\09 %d\09\09 %d\09\09\0A\00"
@.str.7 = [54 x i8] c"Average Waiting Time: %f\0AAverage Turn Around Time: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca i8
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %5
store float 0.000000e+00, float* %10
store float 0.000000e+00, float* %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %13
%21 = alloca %struct.process, i64 %19
store i64 %19, i64* %14
%22 = load i32, i32* %2
%23 = zext i32 %22 to i64
%24 = alloca %struct.scheduling, i64 %23
store i64 %23, i64* %15
store i32 0, i32* %3
br label %25
25: ; preds = %45, %0
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %48
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %32
%34 = getelementptr inbounds %struct.process, %struct.process* %33, i32 0, i32 0
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %34, i64 0, i64 0
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %37
%39 = getelementptr inbounds %struct.process, %struct.process* %38, i32 0, i32 1
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %41
%43 = getelementptr inbounds %struct.process, %struct.process* %42, i32 0, i32 2
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %35, i32* %39, i32* %43)
br label %45
45: ; preds = %29
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %25
48: ; preds = %25
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %50
50: ; preds = %141, %48
%51 = load i32, i32* %3
%52 = load i32, i32* %2
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %144
54: ; preds = %50
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %56
%58 = getelementptr inbounds %struct.process, %struct.process* %57, i32 0, i32 1
%59 = load i32, i32* %58
store i32 %59, i32* %6
%60 = load i32, i32* %3
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %61
%63 = getelementptr inbounds %struct.process, %struct.process* %62, i32 0, i32 2
%64 = load i32, i32* %63
store i32 %64, i32* %7
%65 = load i32, i32* %3
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %66
%68 = getelementptr inbounds %struct.process, %struct.process* %67, i32 0, i32 0
%69 = getelementptr inbounds [10 x i8], [10 x i8]* %68, i64 0, i64 1
%70 = load i8, i8* %69
store i8 %70, i8* %12
%71 = load i32, i32* %3
%72 = sub nsw i32 %71, 1
store i32 %72, i32* %4
br label %73
73: ; preds = %86, %54
%74 = load i32, i32* %4
%75 = icmp sge i32 %74, 0
br i1 %75, label %76, label %84
76: ; preds = %73
%77 = load i32, i32* %6
%78 = load i32, i32* %4
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %79
%81 = getelementptr inbounds %struct.process, %struct.process* %80, i32 0, i32 1
%82 = load i32, i32* %81
%83 = icmp slt i32 %77, %82
br label %84
84: ; preds = %76, %73
%85 = phi i1 [ false, %73 ], [ %83, %76 ]
br i1 %85, label %86, label %121
86: ; preds = %84
%87 = load i32, i32* %4
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %88
%90 = getelementptr inbounds %struct.process, %struct.process* %89, i32 0, i32 1
%91 = load i32, i32* %90
%92 = load i32, i32* %4
%93 = add nsw i32 %92, 1
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %94
%96 = getelementptr inbounds %struct.process, %struct.process* %95, i32 0, i32 1
store i32 %91, i32* %96
%97 = load i32, i32* %4
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %98
%100 = getelementptr inbounds %struct.process, %struct.process* %99, i32 0, i32 2
%101 = load i32, i32* %100
%102 = load i32, i32* %4
%103 = add nsw i32 %102, 1
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %104
%106 = getelementptr inbounds %struct.process, %struct.process* %105, i32 0, i32 2
store i32 %101, i32* %106
%107 = load i32, i32* %4
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %108
%110 = getelementptr inbounds %struct.process, %struct.process* %109, i32 0, i32 0
%111 = getelementptr inbounds [10 x i8], [10 x i8]* %110, i64 0, i64 1
%112 = load i8, i8* %111
%113 = load i32, i32* %4
%114 = add nsw i32 %113, 1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %115
%117 = getelementptr inbounds %struct.process, %struct.process* %116, i32 0, i32 0
%118 = getelementptr inbounds [10 x i8], [10 x i8]* %117, i64 0, i64 1
store i8 %112, i8* %118
%119 = load i32, i32* %4
%120 = add nsw i32 %119, -1
store i32 %120, i32* %4
br label %73
121: ; preds = %84
%122 = load i32, i32* %6
%123 = load i32, i32* %4
%124 = add nsw i32 %123, 1
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %125
%127 = getelementptr inbounds %struct.process, %struct.process* %126, i32 0, i32 1
store i32 %122, i32* %127
%128 = load i32, i32* %7
%129 = load i32, i32* %4
%130 = add nsw i32 %129, 1
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %131
%133 = getelementptr inbounds %struct.process, %struct.process* %132, i32 0, i32 2
store i32 %128, i32* %133
%134 = load i8, i8* %12
%135 = load i32, i32* %4
%136 = add nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %137
%139 = getelementptr inbounds %struct.process, %struct.process* %138, i32 0, i32 0
%140 = getelementptr inbounds [10 x i8], [10 x i8]* %139, i64 0, i64 1
store i8 %134, i8* %140
br label %141
141: ; preds = %121
%142 = load i32, i32* %3
%143 = add nsw i32 %142, 1
store i32 %143, i32* %3
br label %50
144: ; preds = %50
%145 = getelementptr inbounds %struct.process, %struct.process* %21, i64 0
%146 = getelementptr inbounds %struct.process, %struct.process* %145, i32 0, i32 1
%147 = load i32, i32* %146
store i32 %147, i32* %8
store i32 0, i32* %3
br label %148
148: ; preds = %202, %144
%149 = load i32, i32* %3
%150 = load i32, i32* %2
%151 = icmp slt i32 %149, %150
br i1 %151, label %152, label %205
152: ; preds = %148
%153 = load i32, i32* %8
%154 = load i32, i32* %3
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %155
%157 = getelementptr inbounds %struct.process, %struct.process* %156, i32 0, i32 1
%158 = load i32, i32* %157
%159 = sub nsw i32 %153, %158
%160 = load i32, i32* %3
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %24, i64 %161
%163 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %162, i32 0, i32 0
store i32 %159, i32* %163
%164 = load i32, i32* %3
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %24, i64 %165
%167 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %166, i32 0, i32 0
%168 = load i32, i32* %167
%169 = load i32, i32* %3
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %170
%172 = getelementptr inbounds %struct.process, %struct.process* %171, i32 0, i32 2
%173 = load i32, i32* %172
%174 = add nsw i32 %168, %173
%175 = load i32, i32* %3
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %24, i64 %176
%178 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %177, i32 0, i32 1
store i32 %174, i32* %178
%179 = load i32, i32* %8
%180 = load i32, i32* %3
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %181
%183 = getelementptr inbounds %struct.process, %struct.process* %182, i32 0, i32 2
%184 = load i32, i32* %183
%185 = add nsw i32 %179, %184
store i32 %185, i32* %8
%186 = load float, float* %11
%187 = load i32, i32* %3
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %24, i64 %188
%190 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %189, i32 0, i32 0
%191 = load i32, i32* %190
%192 = sitofp i32 %191 to float
%193 = fadd float %186, %192
store float %193, float* %11
%194 = load float, float* %10
%195 = load i32, i32* %3
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %24, i64 %196
%198 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %197, i32 0, i32 1
%199 = load i32, i32* %198
%200 = sitofp i32 %199 to float
%201 = fadd float %194, %200
store float %201, float* %10
br label %202
202: ; preds = %152
%203 = load i32, i32* %3
%204 = add nsw i32 %203, 1
store i32 %204, i32* %3
br label %148
205: ; preds = %148
%206 = load float, float* %10
%207 = fpext float %206 to double
%208 = load i32, i32* %2
%209 = sitofp i32 %208 to double
%210 = fmul double %209, 1.000000e+00
%211 = fdiv double %207, %210
%212 = fptrunc double %211 to float
store float %212, float* %10
%213 = load float, float* %11
%214 = fpext float %213 to double
%215 = load i32, i32* %2
%216 = sitofp i32 %215 to double
%217 = fmul double %216, 1.000000e+00
%218 = fdiv double %214, %217
%219 = fptrunc double %218 to float
store float %219, float* %11
%220 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %221
221: ; preds = %261, %205
%222 = load i32, i32* %3
%223 = load i32, i32* %2
%224 = icmp slt i32 %222, %223
br i1 %224, label %225, label %264
225: ; preds = %221
%226 = load i32, i32* %3
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %227
%229 = getelementptr inbounds %struct.process, %struct.process* %228, i32 0, i32 0
%230 = getelementptr inbounds [10 x i8], [10 x i8]* %229, i64 0, i64 0
%231 = load i8, i8* %230
%232 = sext i8 %231 to i32
%233 = load i32, i32* %3
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %234
%236 = getelementptr inbounds %struct.process, %struct.process* %235, i32 0, i32 0
%237 = getelementptr inbounds [10 x i8], [10 x i8]* %236, i64 0, i64 1
%238 = load i8, i8* %237
%239 = sext i8 %238 to i32
%240 = load i32, i32* %3
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %241
%243 = getelementptr inbounds %struct.process, %struct.process* %242, i32 0, i32 1
%244 = load i32, i32* %243
%245 = load i32, i32* %3
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds %struct.process, %struct.process* %21, i64 %246
%248 = getelementptr inbounds %struct.process, %struct.process* %247, i32 0, i32 2
%249 = load i32, i32* %248
%250 = load i32, i32* %3
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %24, i64 %251
%253 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %252, i32 0, i32 0
%254 = load i32, i32* %253
%255 = load i32, i32* %3
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %24, i64 %256
%258 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %257, i32 0, i32 1
%259 = load i32, i32* %258
%260 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %232, i32 %239, i32 %244, i32 %249, i32 %254, i32 %259)
br label %261
261: ; preds = %225
%262 = load i32, i32* %3
%263 = add nsw i32 %262, 1
store i32 %263, i32* %3
br label %221
264: ; preds = %221
%265 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%266 = load float, float* %11
%267 = fpext float %266 to double
%268 = load float, float* %10
%269 = fpext float %268 to double
%270 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), double %267, double %269)
store i32 0, i32* %1
%271 = load i8*, i8** %13
%272 = load i32, i32* %1
ret i32 %272
}

LLVM IR (-O2):
%struct.process = type { [10 x i8], i32, i32 }
%struct.scheduling = type { i32, i32 }
@.str = [23 x i8] c"enter no. of process: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [49 x i8] c"Enter Process Name,Arrival time and Burst Time :\00"
@.str.3 = [7 x i8] c"%s%d%d\00"
@.str.6 = [28 x i8] c"%c%c\09\09 %d\09\09 %d\09\09 %d\09\09 %d\09\09\0A\00"
@.str.7 = [54 x i8] c"Average Waiting Time: %f\0AAverage Turn Around Time: %f\00"
@str.8 = [71 x i8] c"Process Name arrival_time burst_time waiting_time turn around time\00"
@str.9 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca %struct.process, i64 %6
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = alloca %struct.scheduling, i64 %10
%12 = icmp sgt i32 %9, 0
br i1 %12, label %13, label %24
13: ; preds = %0, %13
%14 = phi i64 [ %20, %13 ], [ 0, %0 ]
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %14, i32 0, i64 0
%17 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %14, i32 1
%18 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %14, i32 2
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %16, i32* %17, i32* %18)
%20 = add nuw nsw i64 %14, 1
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %13, label %24
24: ; preds = %13, %0
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
%26 = load i32, i32* %1
%27 = icmp sgt i32 %26, 1
br i1 %27, label %28, label %63
28: ; preds = %24
%29 = zext i32 %26 to i64
br label %30
30: ; preds = %28, %54
%31 = phi i64 [ 1, %28 ], [ %61, %54 ]
%32 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %31, i32 1
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %31, i32 2
%35 = load i32, i32* %34
%36 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %31, i32 0, i64 1
%37 = load i8, i8* %36
br label %38
38: ; preds = %30, %45
%39 = phi i64 [ %31, %30 ], [ %40, %45 ]
%40 = add nsw i64 %39, -1
%41 = and i64 %40, 4294967295
%42 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %41, i32 1
%43 = load i32, i32* %42
%44 = icmp slt i32 %33, %43
br i1 %44, label %45, label %54
45: ; preds = %38
%46 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %39, i32 1
store i32 %43, i32* %46
%47 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %41, i32 2
%48 = load i32, i32* %47
%49 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %39, i32 2
store i32 %48, i32* %49
%50 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %41, i32 0, i64 1
%51 = load i8, i8* %50
%52 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %39, i32 0, i64 1
store i8 %51, i8* %52
%53 = icmp sgt i64 %39, 1
br i1 %53, label %38, label %54
54: ; preds = %45, %38
%55 = phi i64 [ 0, %45 ], [ %39, %38 ]
%56 = shl i64 %55, 32
%57 = ashr exact i64 %56, 32
%58 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %57, i32 1
store i32 %33, i32* %58
%59 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %57, i32 2
store i32 %35, i32* %59
%60 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %57, i32 0, i64 1
store i8 %37, i8* %60
%61 = add nuw nsw i64 %31, 1
%62 = icmp eq i64 %61, %29
br i1 %62, label %63, label %30
63: ; preds = %54, %24
%64 = icmp sgt i32 %26, 0
br i1 %64, label %65, label %102
65: ; preds = %63
%66 = getelementptr inbounds %struct.process, %struct.process* %8, i64 0, i32 1
%67 = load i32, i32* %66
%68 = zext i32 %26 to i64
%69 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %11, i64 0, i32 0
store i32 0, i32* %69
%70 = getelementptr inbounds %struct.process, %struct.process* %8, i64 0, i32 2
%71 = load i32, i32* %70
%72 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %11, i64 0, i32 1
store i32 %71, i32* %72
%73 = sitofp i32 %71 to float
%74 = icmp eq i32 %26, 1
br i1 %74, label %98, label %75
75: ; preds = %65, %75
%76 = phi i64 [ %94, %75 ], [ 1, %65 ]
%77 = phi float [ %93, %75 ], [ %73, %65 ]
%78 = phi float [ %91, %75 ], [ 0.000000e+00, %65 ]
%79 = phi i32 [ %87, %75 ], [ %71, %65 ]
%80 = phi i32 [ %81, %75 ], [ %67, %65 ]
%81 = add nsw i32 %79, %80
%82 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %76, i32 1
%83 = load i32, i32* %82
%84 = sub nsw i32 %81, %83
%85 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %11, i64 %76, i32 0
store i32 %84, i32* %85
%86 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %76, i32 2
%87 = load i32, i32* %86
%88 = add nsw i32 %87, %84
%89 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %11, i64 %76, i32 1
store i32 %88, i32* %89
%90 = sitofp i32 %84 to float
%91 = fadd float %78, %90
%92 = sitofp i32 %88 to float
%93 = fadd float %77, %92
%94 = add nuw nsw i64 %76, 1
%95 = icmp eq i64 %94, %68
br i1 %95, label %96, label %75
96: ; preds = %75
%97 = fpext float %91 to double
br label %98
98: ; preds = %96, %65
%99 = phi double [ %97, %96 ], [ 0.000000e+00, %65 ]
%100 = phi float [ %93, %96 ], [ %73, %65 ]
%101 = fpext float %100 to double
br label %102
102: ; preds = %98, %63
%103 = phi double [ 0.000000e+00, %63 ], [ %101, %98 ]
%104 = phi double [ 0.000000e+00, %63 ], [ %99, %98 ]
%105 = sitofp i32 %26 to double
%106 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.8, i64 0, i64 0))
%107 = load i32, i32* %1
%108 = icmp sgt i32 %107, 0
br i1 %108, label %109, label %130
109: ; preds = %102, %109
%110 = phi i64 [ %126, %109 ], [ 0, %102 ]
%111 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %110, i32 0, i64 0
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %110, i32 0, i64 1
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %110, i32 1
%118 = load i32, i32* %117
%119 = getelementptr inbounds %struct.process, %struct.process* %8, i64 %110, i32 2
%120 = load i32, i32* %119
%121 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %11, i64 %110, i32 0
%122 = load i32, i32* %121
%123 = getelementptr inbounds %struct.scheduling, %struct.scheduling* %11, i64 %110, i32 1
%124 = load i32, i32* %123
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %113, i32 %116, i32 %118, i32 %120, i32 %122, i32 %124)
%126 = add nuw nsw i64 %110, 1
%127 = load i32, i32* %1
%128 = sext i32 %127 to i64
%129 = icmp slt i64 %126, %128
br i1 %129, label %109, label %130
130: ; preds = %109, %102
%131 = fdiv double %104, %105
%132 = fptrunc double %131 to float
%133 = fdiv double %103, %105
%134 = fptrunc double %133 to float
%135 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
%136 = fpext float %132 to double
%137 = fpext float %134 to double
%138 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), double %136, double %137)
ret i32 0
}