#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 */
typedef int clock_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int clock();
int /*<<< orphan*/ close(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *);
int parametric_pipelining(int *, int *, int *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main(int argc, char *argv[]) {
  int i, m = 0, j = 1, n;
  if (argc != 3) {
    printf("Usage: %s <number_of_processors> <instance_filename>\n", argv[0]);
    exit(0);
  }
  for (i = strlen(argv[1]); i > 0; i--) {
    m += ((*(argv[1] + i - 1)) - '0') * j;
    j = j * 10;
  }
  FILE *fp_in;
  fp_in = fopen(argv[2], "r");
  if (fp_in != NULL) {
    fscanf(fp_in, "%d", &n);
  } else {
    printf("Cant open file %s\n", argv[2]);
    exit(0);
  }
  int P[n], PS[n + 1];
  PS[0] = 0;
  for (i = 0; i < n; i++) {
    if ((fscanf(fp_in, "%d", &P[i])) > 0) {
      PS[i + 1] = PS[i] + P[i];
    } else {
      printf("Not enough arguments in Instance file\n");
      exit(0);
    }
  }
  close(fp_in);
  printf("\nNumber of tasks: %d\n", n);
  printf("Number of processors: %d\n", m);
  printf("Ltotal = %d\n", PS[n]);
  int L[m];
  clock_t tic = clock();
  int Lparametric = parametric_pipelining(P, PS, L, m, n);
  clock_t toc = clock() - tic;
  printf("The max load using parametric pipelining is %d\n\n", Lparametric);
  printf("The load split on different processors is:\n");
  for (i = 0; i < m; i++) {
    printf("L%d = %d\n", i, L[i]);
  }
  printf("Time taken is: %d\n", (toc));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11cd <main+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    121a <main+0x9a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x14(%rbp),%rcx
movsbl -0x1(%rax,%rcx,1),%eax
sub    $0x30,%eax
imul   -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0xa,-0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11dd <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe0d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1256 <main+0xd6>
mov    -0x28(%rbp),%rdi
lea    0xdf0(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1060 <fscanf@plt>
jmp    1273 <main+0xf3>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,%ecx
lea    0xf(,%rcx,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x60(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x40(%rbp)
movl   $0x0,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1350 <main+0x1d0>
mov    -0x68(%rbp),%rdx
mov    -0x28(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xd46(%rip),%rsi
call   1060 <fscanf@plt>
cmp    $0x0,%rax
jle    1328 <main+0x1a8>
mov    -0x60(%rbp),%rax
mov    -0x68(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    (%rax,%rdx,4),%edx
movslq -0x14(%rbp),%rsi
add    (%rcx,%rsi,4),%edx
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    133d <main+0x1bd>
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
jmp    1342 <main+0x1c2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12cc <main+0x14c>
mov    -0x28(%rbp),%rdi
call   1070 <close@plt>
mov    -0x20(%rbp),%esi
lea    0xd12(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x71(%rbp)
call   1050 <printf@plt>
mov    -0x71(%rbp),%al
mov    -0x18(%rbp),%esi
lea    0xd11(%rip),%rdi
call   1050 <printf@plt>
mov    -0x60(%rbp),%rcx
mov    -0x71(%rbp),%al
movslq -0x20(%rbp),%rdx
mov    (%rcx,%rdx,4),%esi
lea    0xd11(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1080 <parametric_pipelining@plt>
mov    %eax,-0x50(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x4c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x50(%rbp),%esi
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xce0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1447 <main+0x2c7>
mov    -0x70(%rbp),%rax
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1411 <main+0x291>
mov    -0x54(%rbp),%esi
lea    0xcc8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%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
mov    %rsi,%r14
cmp    $0x3,%edi
jne    1456 <main+0x2c6>
mov    0x8(%r14),%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    11da <main+0x4a>
mov    0x8(%r14),%r9
mov    %eax,%esi
lea    -0x1(%rsi),%rcx
mov    %esi,%r8d
and    $0x3,%r8d
cmp    $0x3,%rcx
jae    11e1 <main+0x51>
mov    $0x1,%ecx
xor    %ebx,%ebx
jmp    1245 <main+0xb5>
xor    %ebx,%ebx
jmp    127a <main+0xea>
mov    %esi,%edi
and    $0xfffffffc,%edi
mov    $0x1,%ecx
xor    %ebx,%ebx
nopl   (%rax)
movsbl -0x1(%r9,%rsi,1),%eax
add    $0xffffffd0,%eax
imul   %ecx,%eax
add    %ebx,%eax
movsbl -0x2(%r9,%rsi,1),%ebx
add    $0xffffffd0,%ebx
imul   %ecx,%ebx
lea    (%rbx,%rbx,4),%ebx
lea    (%rax,%rbx,2),%eax
movsbl -0x3(%r9,%rsi,1),%ebx
add    $0xffffffd0,%ebx
imul   %ecx,%ebx
imul   $0x64,%ebx,%edx
add    %eax,%edx
movsbl -0x4(%r9,%rsi,1),%eax
add    $0xffffffd0,%eax
imul   %ecx,%eax
imul   $0x3e8,%eax,%ebx
add    %edx,%ebx
imul   $0x2710,%ecx,%ecx
add    $0xfffffffffffffffc,%rsi
add    $0xfffffffffffffffc,%rdi
jne    11f0 <main+0x60>
test   %r8,%r8
je     127a <main+0xea>
lea    (%rsi,%r9,1),%rdx
add    $0xffffffffffffffff,%rdx
neg    %r8
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movsbl (%rdx,%rsi,1),%eax
add    $0xffffffd0,%eax
imul   %ecx,%eax
add    %eax,%ebx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
add    $0xffffffffffffffff,%rsi
cmp    %rsi,%r8
jne    1260 <main+0xd0>
mov    0x10(%r14),%rdi
lea    0xdb1(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1462 <main+0x2d2>
lea    0xd9e(%rip),%rsi
lea    -0x2c(%rbp),%rdx
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <fscanf@plt>
mov    -0x38(%rbp),%rdi
mov    %rsp,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rcx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    -0x2c(%rbp),%eax
lea    0x1(%rax),%ecx
mov    %rsp,%rdx
lea    0xf(,%rcx,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rdx,%rsi
sub    %rcx,%rsi
mov    %rsi,%r12
mov    %rsi,%rsp
neg    %rcx
movl   $0x0,(%rdx,%rcx,1)
test   %eax,%eax
jle    1345 <main+0x1b5>
xor    %r13d,%r13d
mov    -0x40(%rbp),%r14
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
lea    0xd21(%rip),%rsi
mov    %r14,%rdx
call   1070 <fscanf@plt>
test   %rax,%rax
jle    1443 <main+0x2b3>
add    (%r14),%r13d
mov    %r13d,0x4(%r12,%r15,4)
add    $0x1,%r15
movslq -0x2c(%rbp),%rax
add    $0x4,%r14
cmp    %rax,%r15
mov    -0x38(%rbp),%rdi
jl     1310 <main+0x180>
call   1080 <close@plt>
mov    -0x2c(%rbp),%esi
lea    0xcfa(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd02(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movslq -0x2c(%rbp),%rax
mov    %r12,%r14
mov    (%r12,%rax,4),%esi
lea    0xd01(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%r13d
mov    %rsp,%r12
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
xor    %eax,%eax
call   1040 <clock@plt>
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%r8d
mov    -0x40(%rbp),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
call   1090 <parametric_pipelining@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1040 <clock@plt>
mov    %eax,%r14d
lea    0xcbc(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xcf9(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    1419 <main+0x289>
lea    0xccc(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12,%rbx,4),%edx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1400 <main+0x270>
sub    -0x38(%rbp),%r14d
lea    0xca2(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x48(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcba(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    (%r14),%rsi
lea    0xba0(%rip),%rdi
jmp    146d <main+0x2dd>
mov    0x10(%r14),%rsi
lea    0xbce(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"Usage: %s <number_of_processors> <instance_filename>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"Cant open file %s\0A\00"
@.str.4 = [39 x i8] c"Not enough arguments in Instance file\0A\00"
@.str.5 = [22 x i8] c"\0ANumber of tasks: %d\0A\00"
@.str.6 = [26 x i8] c"Number of processors: %d\0A\00"
@.str.7 = [13 x i8] c"Ltotal = %d\0A\00"
@.str.8 = [49 x i8] c"The max load using parametric pipelining is %d\0A\0A\00"
@.str.9 = [44 x i8] c"The load split on different processors is:\0A\00"
@.str.10 = [10 x i8] c"L%d = %d\0A\00"
@.str.11 = [19 x i8] c"Time taken is: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 1, i32* %8
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %26
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @strlen(i8* %29)
store i32 %30, i32* %6
br label %31
31: ; preds = %51, %26
%32 = load i32, i32* %6
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %54
34: ; preds = %31
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = getelementptr inbounds i8, i8* %40, i64 -1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = sub nsw i32 %43, 48
%45 = load i32, i32* %8
%46 = mul nsw i32 %44, %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, %46
store i32 %48, i32* %7
%49 = load i32, i32* %8
%50 = mul nsw i32 %49, 10
store i32 %50, i32* %8
br label %51
51: ; preds = %34
%52 = load i32, i32* %6
%53 = add nsw i32 %52, -1
store i32 %53, i32* %6
br label %31
54: ; preds = %31
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 2
%57 = load i8*, i8** %56
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %58, i32** %10
%59 = load i32*, i32** %10
%60 = icmp ne i32* %59, null
br i1 %60, label %61, label %64
61: ; preds = %54
%62 = load i32*, i32** %10
%63 = call i64 @fscanf(i32* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %9)
br label %70
64: ; preds = %54
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %67)
%69 = call i32 @exit(i32 0)
unreachable
70: ; preds = %61
%71 = load i32, i32* %9
%72 = zext i32 %71 to i64
%73 = call i8* @llvm.stacksave()
store i8* %73, i8** %11
%74 = alloca i32, i64 %72
store i64 %72, i64* %12
%75 = load i32, i32* %9
%76 = add nsw i32 %75, 1
%77 = zext i32 %76 to i64
%78 = alloca i32, i64 %77
store i64 %77, i64* %13
%79 = getelementptr inbounds i32, i32* %78, i64 0
store i32 0, i32* %79
store i32 0, i32* %6
br label %80
80: ; preds = %109, %70
%81 = load i32, i32* %6
%82 = load i32, i32* %9
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %112
84: ; preds = %80
%85 = load i32*, i32** %10
%86 = load i32, i32* %6
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i32, i32* %74, i64 %87
%89 = call i64 @fscanf(i32* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %88)
%90 = icmp sgt i64 %89, 0
br i1 %90, label %91, label %105
91: ; preds = %84
%92 = load i32, i32* %6
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i32, i32* %78, i64 %93
%95 = load i32, i32* %94
%96 = load i32, i32* %6
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i32, i32* %74, i64 %97
%99 = load i32, i32* %98
%100 = add nsw i32 %95, %99
%101 = load i32, i32* %6
%102 = add nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i32, i32* %78, i64 %103
store i32 %100, i32* %104
br label %108
105: ; preds = %84
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%107 = call i32 @exit(i32 0)
unreachable
108: ; preds = %91
br label %109
109: ; preds = %108
%110 = load i32, i32* %6
%111 = add nsw i32 %110, 1
store i32 %111, i32* %6
br label %80
112: ; preds = %80
%113 = load i32*, i32** %10
%114 = call i32 @close(i32* %113)
%115 = load i32, i32* %9
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %115)
%117 = load i32, i32* %7
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %117)
%119 = load i32, i32* %9
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i32, i32* %78, i64 %120
%122 = load i32, i32* %121
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %122)
%124 = load i32, i32* %7
%125 = zext i32 %124 to i64
%126 = alloca i32, i64 %125
store i64 %125, i64* %14
%127 = call i32 (...) @clock()
store i32 %127, i32* %15
%128 = load i32, i32* %7
%129 = load i32, i32* %9
%130 = call i32 @parametric_pipelining(i32* %74, i32* %78, i32* %126, i32 %128, i32 %129)
store i32 %130, i32* %16
%131 = call i32 (...) @clock()
%132 = load i32, i32* %15
%133 = sub nsw i32 %131, %132
store i32 %133, i32* %17
%134 = load i32, i32* %16
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i32 %134)
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %6
br label %137
137: ; preds = %148, %112
%138 = load i32, i32* %6
%139 = load i32, i32* %7
%140 = icmp slt i32 %138, %139
br i1 %140, label %141, label %151
141: ; preds = %137
%142 = load i32, i32* %6
%143 = load i32, i32* %6
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i32, i32* %126, i64 %144
%146 = load i32, i32* %145
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %142, i32 %146)
br label %148
148: ; preds = %141
%149 = load i32, i32* %6
%150 = add nsw i32 %149, 1
store i32 %150, i32* %6
br label %137
151: ; preds = %137
%152 = load i32, i32* %17
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %152)
%154 = load i8*, i8** %11
%155 = load i32, i32* %3
ret i32 %155
}

LLVM IR (-O2):
@.str = [54 x i8] c"Usage: %s <number_of_processors> <instance_filename>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"Cant open file %s\0A\00"
@.str.5 = [22 x i8] c"\0ANumber of tasks: %d\0A\00"
@.str.6 = [26 x i8] c"Number of processors: %d\0A\00"
@.str.7 = [13 x i8] c"Ltotal = %d\0A\00"
@.str.8 = [49 x i8] c"The max load using parametric pipelining is %d\0A\0A\00"
@.str.10 = [10 x i8] c"L%d = %d\0A\00"
@.str.11 = [19 x i8] c"Time taken is: %d\0A\00"
@str = [43 x i8] c"The load split on different processors is:\00"
@str.12 = [38 x i8] c"Not enough arguments in Instance file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 3
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strlen(i8* %12)
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %84
15: ; preds = %10
%16 = load i8*, i8** %11
%17 = zext i32 %13 to i64
%18 = getelementptr inbounds i8, i8* %16, i64 -1
%19 = add nsw i64 %17, -1
%20 = and i64 %17, 3
%21 = icmp ult i64 %19, 3
br i1 %21, label %63, label %22
22: ; preds = %15
%23 = and i64 %17, 4294967292
br label %24
24: ; preds = %24, %22
%25 = phi i64 [ %17, %22 ], [ %60, %24 ]
%26 = phi i32 [ 0, %22 ], [ %58, %24 ]
%27 = phi i32 [ 1, %22 ], [ %59, %24 ]
%28 = phi i64 [ 0, %22 ], [ %61, %24 ]
%29 = getelementptr inbounds i8, i8* %18, i64 %25
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = add nsw i32 %31, -48
%33 = mul nsw i32 %32, %27
%34 = add nsw i32 %33, %26
%35 = mul nsw i32 %27, 10
%36 = add nsw i64 %25, -1
%37 = getelementptr inbounds i8, i8* %18, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = add nsw i32 %39, -48
%41 = mul nsw i32 %40, %35
%42 = add nsw i32 %41, %34
%43 = mul i32 %27, 100
%44 = add nsw i64 %25, -2
%45 = getelementptr inbounds i8, i8* %18, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = add nsw i32 %47, -48
%49 = mul nsw i32 %48, %43
%50 = add nsw i32 %49, %42
%51 = mul i32 %27, 1000
%52 = add nsw i64 %25, -3
%53 = getelementptr inbounds i8, i8* %18, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = add nsw i32 %55, -48
%57 = mul nsw i32 %56, %51
%58 = add nsw i32 %57, %50
%59 = mul i32 %27, 10000
%60 = add nsw i64 %25, -4
%61 = add i64 %28, 4
%62 = icmp eq i64 %61, %23
br i1 %62, label %63, label %24
63: ; preds = %24, %15
%64 = phi i32 [ undef, %15 ], [ %58, %24 ]
%65 = phi i64 [ %17, %15 ], [ %60, %24 ]
%66 = phi i32 [ 0, %15 ], [ %58, %24 ]
%67 = phi i32 [ 1, %15 ], [ %59, %24 ]
%68 = icmp eq i64 %20, 0
br i1 %68, label %84, label %69
69: ; preds = %63, %69
%70 = phi i64 [ %81, %69 ], [ %65, %63 ]
%71 = phi i32 [ %79, %69 ], [ %66, %63 ]
%72 = phi i32 [ %80, %69 ], [ %67, %63 ]
%73 = phi i64 [ %82, %69 ], [ 0, %63 ]
%74 = getelementptr inbounds i8, i8* %18, i64 %70
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = add nsw i32 %76, -48
%78 = mul nsw i32 %77, %72
%79 = add nsw i32 %78, %71
%80 = mul nsw i32 %72, 10
%81 = add nsw i64 %70, -1
%82 = add i64 %73, 1
%83 = icmp eq i64 %82, %20
br i1 %83, label %84, label %69
84: ; preds = %63, %69, %10
%85 = phi i32 [ 0, %10 ], [ %64, %63 ], [ %79, %69 ]
%86 = getelementptr inbounds i8*, i8** %1, i64 2
%87 = load i8*, i8** %86
%88 = tail call i32* @fopen(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%89 = icmp eq i32* %88, null
br i1 %89, label %101, label %90
90: ; preds = %84
%91 = call i64 @fscanf(i32* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%92 = load i32, i32* %3
%93 = zext i32 %92 to i64
%94 = call i8* @llvm.stacksave()
%95 = alloca i32, i64 %93
%96 = load i32, i32* %3
%97 = add nsw i32 %96, 1
%98 = zext i32 %97 to i64
%99 = alloca i32, i64 %98
store i32 0, i32* %99
%100 = icmp sgt i32 %96, 0
br i1 %100, label %105, label %122
101: ; preds = %84
%102 = load i8*, i8** %86
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %102)
%104 = tail call i32 @exit(i32 0)
unreachable
105: ; preds = %90, %111
%106 = phi i32 [ %113, %111 ], [ 0, %90 ]
%107 = phi i64 [ %114, %111 ], [ 0, %90 ]
%108 = getelementptr inbounds i32, i32* %95, i64 %107
%109 = call i64 @fscanf(i32* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %108)
%110 = icmp sgt i64 %109, 0
br i1 %110, label %111, label %119
111: ; preds = %105
%112 = load i32, i32* %108
%113 = add nsw i32 %112, %106
%114 = add nuw nsw i64 %107, 1
%115 = getelementptr inbounds i32, i32* %99, i64 %114
store i32 %113, i32* %115
%116 = load i32, i32* %3
%117 = sext i32 %116 to i64
%118 = icmp slt i64 %114, %117
br i1 %118, label %105, label %122
119: ; preds = %105
%120 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.12, i64 0, i64 0))
%121 = call i32 @exit(i32 0)
unreachable
122: ; preds = %111, %90
%123 = call i32 @close(i32* %88)
%124 = load i32, i32* %3
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %124)
%126 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %85)
%127 = load i32, i32* %3
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i32, i32* %99, i64 %128
%130 = load i32, i32* %129
%131 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %130)
%132 = zext i32 %85 to i64
%133 = alloca i32, i64 %132
%134 = call i32 (...) @clock()
%135 = load i32, i32* %3
%136 = call i32 @parametric_pipelining(i32* %95, i32* %99, i32* %133, i32 %85, i32 %135)
%137 = call i32 (...) @clock()
%138 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i32 %136)
%139 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%140 = icmp sgt i32 %85, 0
br i1 %140, label %141, label %149
141: ; preds = %122, %141
%142 = phi i64 [ %147, %141 ], [ 0, %122 ]
%143 = getelementptr inbounds i32, i32* %133, i64 %142
%144 = load i32, i32* %143
%145 = trunc i64 %142 to i32
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %145, i32 %144)
%147 = add nuw nsw i64 %142, 1
%148 = icmp eq i64 %147, %132
br i1 %148, label %149, label %141
149: ; preds = %141, %122
%150 = sub nsw i32 %137, %134
%151 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %150)
ret i32 0
}