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

/* Variables and functions */
int /*<<< orphan*/ close(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *);
int heuristic_pipelining(int *, int *, int *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf("Usage: %s <number_of_processors> <instance_filename>\n", argv[0]);
    exit(0);
  }
  int i, m = 0, j = 1, n;
  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];
  int Lheur = heuristic_pipelining(P, PS, L, m, n);
  printf("The max load using heuristic pipelining is %d\n\n", Lheur);
  printf("The load split on different processors is:\n");
  for (i = 0; i < m; i++) {
    printf("L%d = %d\n", i, L[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11ac <main+0x3c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1207 <main+0x97>
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    11ca <main+0x5a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe20(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1243 <main+0xd3>
mov    -0x28(%rbp),%rdi
lea    0xe03(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <fscanf@plt>
jmp    1260 <main+0xf0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <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,-0x60(%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,-0x58(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x40(%rbp)
movl   $0x0,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    133d <main+0x1cd>
mov    -0x60(%rbp),%rdx
mov    -0x28(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xd59(%rip),%rsi
call   1050 <fscanf@plt>
cmp    $0x0,%rax
jle    1315 <main+0x1a5>
mov    -0x58(%rbp),%rax
mov    -0x60(%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    132a <main+0x1ba>
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
jmp    132f <main+0x1bf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12b9 <main+0x149>
mov    -0x28(%rbp),%rdi
call   1060 <close@plt>
mov    -0x20(%rbp),%esi
lea    0xd25(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x69(%rbp)
call   1040 <printf@plt>
mov    -0x69(%rbp),%al
mov    -0x18(%rbp),%esi
lea    0xd24(%rip),%rdi
call   1040 <printf@plt>
mov    -0x58(%rbp),%rcx
mov    -0x69(%rbp),%al
movslq -0x20(%rbp),%rdx
mov    (%rcx,%rdx,4),%esi
lea    0xd24(%rip),%rdi
call   1040 <printf@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x18(%rbp),%eax
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x68(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1090 <heuristic_pipelining@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
lea    0xceb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1419 <main+0x2a9>
mov    -0x68(%rbp),%rax
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13e3 <main+0x273>
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    1411 <main+0x291>
mov    0x8(%r14),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11ca <main+0x4a>
mov    0x8(%r14),%r9
mov    %eax,%esi
lea    -0x1(%rsi),%rcx
mov    %esi,%r8d
and    $0x3,%r8d
cmp    $0x3,%rcx
jae    11d1 <main+0x51>
mov    $0x1,%ecx
xor    %ebx,%ebx
jmp    1235 <main+0xb5>
xor    %ebx,%ebx
jmp    126a <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    11e0 <main+0x60>
test   %r8,%r8
je     126a <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    1250 <main+0xd0>
mov    0x10(%r14),%rdi
lea    0xdc1(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     141d <main+0x29d>
lea    0xdae(%rip),%rsi
lea    -0x2c(%rbp),%rdx
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <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,%r15
mov    %rsi,%rsp
neg    %rcx
movl   $0x0,(%rdx,%rcx,1)
test   %eax,%eax
jle    1335 <main+0x1b5>
xor    %r13d,%r13d
mov    -0x40(%rbp),%r14
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
lea    0xd31(%rip),%rsi
mov    %r14,%rdx
call   1060 <fscanf@plt>
test   %rax,%rax
jle    13fe <main+0x27e>
add    (%r14),%r13d
mov    %r13d,0x4(%r15,%r12,4)
add    $0x1,%r12
movslq -0x2c(%rbp),%rax
add    $0x4,%r14
cmp    %rax,%r12
mov    -0x38(%rbp),%rdi
jl     1300 <main+0x180>
call   1070 <close@plt>
mov    -0x2c(%rbp),%esi
lea    0xd0a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd12(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movslq -0x2c(%rbp),%rax
mov    (%r15,%rax,4),%esi
lea    0xd14(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%r13d
mov    %rsp,%r12
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    -0x2c(%rbp),%r8d
mov    -0x40(%rbp),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
call   10a0 <heuristic_pipelining@plt>
lea    0xce6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd10(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    13e9 <main+0x269>
lea    0xcf6(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    13d0 <main+0x250>
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    0xceb(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    (%r14),%rsi
lea    0xbe5(%rip),%rdi
jmp    1428 <main+0x2a8>
mov    0x10(%r14),%rsi
lea    0xc13(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <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 = [48 x i8] c"The max load using heuristic 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"
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %2
store i32 0, i32* %7
store i32 1, i32* %8
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @strlen(i8* %27)
store i32 %28, i32* %6
br label %29
29: ; preds = %49, %24
%30 = load i32, i32* %6
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %52
32: ; preds = %29
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = getelementptr inbounds i8, i8* %38, i64 -1
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = sub nsw i32 %41, 48
%43 = load i32, i32* %8
%44 = mul nsw i32 %42, %43
%45 = load i32, i32* %7
%46 = add nsw i32 %45, %44
store i32 %46, i32* %7
%47 = load i32, i32* %8
%48 = mul nsw i32 %47, 10
store i32 %48, i32* %8
br label %49
49: ; preds = %32
%50 = load i32, i32* %6
%51 = add nsw i32 %50, -1
store i32 %51, i32* %6
br label %29
52: ; preds = %29
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %56, i32** %10
%57 = load i32*, i32** %10
%58 = icmp ne i32* %57, null
br i1 %58, label %59, label %62
59: ; preds = %52
%60 = load i32*, i32** %10
%61 = call i64 @fscanf(i32* %60, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %9)
br label %68
62: ; preds = %52
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 2
%65 = load i8*, i8** %64
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %65)
%67 = call i32 @exit(i32 0)
unreachable
68: ; preds = %59
%69 = load i32, i32* %9
%70 = zext i32 %69 to i64
%71 = call i8* @llvm.stacksave()
store i8* %71, i8** %11
%72 = alloca i32, i64 %70
store i64 %70, i64* %12
%73 = load i32, i32* %9
%74 = add nsw i32 %73, 1
%75 = zext i32 %74 to i64
%76 = alloca i32, i64 %75
store i64 %75, i64* %13
%77 = getelementptr inbounds i32, i32* %76, i64 0
store i32 0, i32* %77
store i32 0, i32* %6
br label %78
78: ; preds = %107, %68
%79 = load i32, i32* %6
%80 = load i32, i32* %9
%81 = icmp slt i32 %79, %80
br i1 %81, label %82, label %110
82: ; preds = %78
%83 = load i32*, i32** %10
%84 = load i32, i32* %6
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i32, i32* %72, i64 %85
%87 = call i64 @fscanf(i32* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %86)
%88 = icmp sgt i64 %87, 0
br i1 %88, label %89, label %103
89: ; preds = %82
%90 = load i32, i32* %6
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i32, i32* %76, i64 %91
%93 = load i32, i32* %92
%94 = load i32, i32* %6
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %72, i64 %95
%97 = load i32, i32* %96
%98 = add nsw i32 %93, %97
%99 = load i32, i32* %6
%100 = add nsw i32 %99, 1
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i32, i32* %76, i64 %101
store i32 %98, i32* %102
br label %106
103: ; preds = %82
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%105 = call i32 @exit(i32 0)
unreachable
106: ; preds = %89
br label %107
107: ; preds = %106
%108 = load i32, i32* %6
%109 = add nsw i32 %108, 1
store i32 %109, i32* %6
br label %78
110: ; preds = %78
%111 = load i32*, i32** %10
%112 = call i32 @close(i32* %111)
%113 = load i32, i32* %9
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %113)
%115 = load i32, i32* %7
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %115)
%117 = load i32, i32* %9
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i32, i32* %76, i64 %118
%120 = load i32, i32* %119
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %120)
%122 = load i32, i32* %7
%123 = zext i32 %122 to i64
%124 = alloca i32, i64 %123
store i64 %123, i64* %14
%125 = load i32, i32* %7
%126 = load i32, i32* %9
%127 = call i32 @heuristic_pipelining(i32* %72, i32* %76, i32* %124, i32 %125, i32 %126)
store i32 %127, i32* %15
%128 = load i32, i32* %15
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), i32 %128)
%130 = 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 %131
131: ; preds = %142, %110
%132 = load i32, i32* %6
%133 = load i32, i32* %7
%134 = icmp slt i32 %132, %133
br i1 %134, label %135, label %145
135: ; preds = %131
%136 = load i32, i32* %6
%137 = load i32, i32* %6
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds i32, i32* %124, i64 %138
%140 = load i32, i32* %139
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %136, i32 %140)
br label %142
142: ; preds = %135
%143 = load i32, i32* %6
%144 = add nsw i32 %143, 1
store i32 %144, i32* %6
br label %131
145: ; preds = %131
%146 = load i8*, i8** %11
%147 = load i32, i32* %3
ret i32 %147
}

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 = [48 x i8] c"The max load using heuristic pipelining is %d\0A\0A\00"
@.str.10 = [10 x i8] c"L%d = %d\0A\00"
@str = [43 x i8] c"The load split on different processors is:\00"
@str.11 = [38 x i8] c"Not enough arguments in Instance file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 3
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = bitcast i32* %3 to i8*
%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 = %9
%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, %9
%85 = phi i32 [ 0, %9 ], [ %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.11, 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 = load i32, i32* %3
%135 = call i32 @heuristic_pipelining(i32* %95, i32* %99, i32* %133, i32 %85, i32 %134)
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), i32 %135)
%137 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%138 = icmp sgt i32 %85, 0
br i1 %138, label %139, label %147
139: ; preds = %122, %139
%140 = phi i64 [ %145, %139 ], [ 0, %122 ]
%141 = getelementptr inbounds i32, i32* %133, i64 %140
%142 = load i32, i32* %141
%143 = trunc i64 %140 to i32
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %143, i32 %142)
%145 = add nuw nsw i64 %140, 1
%146 = icmp eq i64 %145, %132
br i1 %146, label %147, label %139
147: ; preds = %139, %122
ret i32 0
}