#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 */
scalar_t__ EOF;
double elapsed_time(long long, long long);
int /*<<< orphan*/ free(int *);
long long get_time();
scalar_t__ malloc(int);
int /*<<< orphan*/ particleFilter(int *, int, int, int, int *, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sscanf(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
int time(int /*<<< orphan*/);
int /*<<< orphan*/ videoSequence(int *, int, int, int, int *);
int main(int argc, char *argv[]) {
  char *usage = "openmp.out -x <dimX> -y <dimY> -z <Nfr> -np <Nparticles>";
  if (argc != 9) {
    printf("%s\n", usage);
    return 0;
  }
  if (strcmp(argv[1], "-x") || strcmp(argv[3], "-y") || strcmp(argv[5], "-z") ||
      strcmp(argv[7], "-np")) {
    printf("%s\n", usage);
    return 0;
  }
  int IszX, IszY, Nfr, Nparticles;
  if (sscanf(argv[2], "%d", &IszX) == EOF) {
    printf("ERROR: dimX input is incorrect");
    return 0;
  }
  if (IszX <= 0) {
    printf("dimX must be > 0\n");
    return 0;
  }
  if (sscanf(argv[4], "%d", &IszY) == EOF) {
    printf("ERROR: dimY input is incorrect");
    return 0;
  }
  if (IszY <= 0) {
    printf("dimY must be > 0\n");
    return 0;
  }
  if (sscanf(argv[6], "%d", &Nfr) == EOF) {
    printf("ERROR: Number of frames input is incorrect");
    return 0;
  }
  if (Nfr <= 0) {
    printf("number of frames must be > 0\n");
    return 0;
  }
  if (sscanf(argv[8], "%d", &Nparticles) == EOF) {
    printf("ERROR: Number of particles input is incorrect");
    return 0;
  }
  if (Nparticles <= 0) {
    printf("Number of particles must be > 0\n");
    return 0;
  }
  int *seed = (int *)malloc(sizeof(int) * Nparticles);
  int i;
  for (i = 0; i < Nparticles; i++)
    seed[i] = time(0) * i;
  int *I = (int *)malloc(sizeof(int) * IszX * IszY * Nfr);
  long long start = get_time();
  videoSequence(I, IszX, IszY, Nfr, seed);
  long long endVideoSequence = get_time();
  printf("VIDEO SEQUENCE TOOK %f\n", elapsed_time(start, endVideoSequence));
  particleFilter(I, IszX, IszY, Nfr, seed, Nparticles);
  long long endParticleFilter = get_time();
  printf("PARTICLE FILTER TOOK %f\n",
         elapsed_time(endVideoSequence, endParticleFilter));
  printf("ENTIRE PROGRAM TOOK %f\n", elapsed_time(start, endParticleFilter));
  free(seed);
  free(I);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe43(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x9,-0x8(%rbp)
je     11e9 <main+0x49>
mov    -0x18(%rbp),%rsi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe45(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1261 <main+0xc1>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe2a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1261 <main+0xc1>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xe0f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1261 <main+0xc1>
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
lea    0xdf4(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     127f <main+0xdf>
mov    -0x18(%rbp),%rsi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdbc(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    0x2d4a(%rip),%rcx
cmp    (%rcx),%rax
jne    12c1 <main+0x121>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
cmpl   $0x0,-0x1c(%rbp)
jg     12e5 <main+0x145>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xd56(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    0x2ce4(%rip),%rcx
cmp    (%rcx),%rax
jne    1327 <main+0x187>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
cmpl   $0x0,-0x20(%rbp)
jg     134b <main+0x1ab>
lea    0xd65(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
lea    0xcf0(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    0x2c7e(%rip),%rcx
cmp    (%rcx),%rax
jne    138d <main+0x1ed>
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
cmpl   $0x0,-0x24(%rbp)
jg     13b1 <main+0x211>
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rdi
lea    0xc8a(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    0x2c18(%rip),%rcx
cmp    (%rcx),%rax
jne    13f3 <main+0x253>
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
cmpl   $0x0,-0x28(%rbp)
jg     1417 <main+0x277>
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1541 <main+0x3a1>
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1463 <main+0x2c3>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edx
imul   -0x34(%rbp),%edx
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1431 <main+0x291>
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
movslq -0x24(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1060 <get_time@plt>
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%r8
call   10b0 <videoSequence@plt>
mov    $0x0,%al
call   1060 <get_time@plt>
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1040 <elapsed_time@plt>
lea    0xc81(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    -0x28(%rbp),%r9d
call   10c0 <particleFilter@plt>
mov    $0x0,%al
call   1060 <get_time@plt>
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1040 <elapsed_time@plt>
lea    0xc59(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1040 <elapsed_time@plt>
lea    0xc57(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x9,%edi
jne    121a <main+0x6a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe68(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    121a <main+0x6a>
mov    0x18(%rbx),%rdi
lea    0xe56(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    121a <main+0x6a>
mov    0x28(%rbx),%rdi
lea    0xe44(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    121a <main+0x6a>
mov    0x38(%rbx),%rdi
lea    0xe32(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1237 <main+0x87>
lea    0xddf(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rbx),%rdi
lea    0xe04(%rip),%rsi
lea    0x14(%rsp),%rdx
call   10b0 <sscanf@plt>
mov    0x2d95(%rip),%r14
cmp    (%r14),%rax
jne    1264 <main+0xb4>
lea    0xdea(%rip),%rdi
jmp    12f5 <main+0x145>
cmpl   $0x0,0x14(%rsp)
jle    128e <main+0xde>
mov    0x20(%rbx),%rdi
lea    0xdd0(%rip),%rsi
lea    0x10(%rsp),%rdx
call   10b0 <sscanf@plt>
cmp    (%r14),%rax
jne    1297 <main+0xe7>
lea    0xddc(%rip),%rdi
jmp    12f5 <main+0x145>
lea    0xee2(%rip),%rdi
jmp    1221 <main+0x71>
cmpl   $0x0,0x10(%rsp)
jle    12c1 <main+0x111>
mov    0x30(%rbx),%rdi
lea    0xd9d(%rip),%rsi
lea    0xc(%rsp),%rdx
call   10b0 <sscanf@plt>
cmp    (%r14),%rax
jne    12cd <main+0x11d>
lea    0xdc8(%rip),%rdi
jmp    12f5 <main+0x145>
lea    0xe9e(%rip),%rdi
jmp    1221 <main+0x71>
cmpl   $0x0,0xc(%rsp)
jle    1301 <main+0x151>
mov    0x40(%rbx),%rdi
lea    0xd67(%rip),%rsi
lea    0x8(%rsp),%rdx
call   10b0 <sscanf@plt>
cmp    (%r14),%rax
jne    130d <main+0x15d>
lea    0xdbd(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1226 <main+0x76>
lea    0xe41(%rip),%rdi
jmp    1221 <main+0x71>
mov    0x8(%rsp),%edi
test   %edi,%edi
jle    1415 <main+0x265>
shl    $0x2,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbp
cmpl   $0x0,0x8(%rsp)
jle    134b <main+0x19b>
xor    %ebx,%ebx
xor    %edi,%edi
call   1090 <time@plt>
mov    %ebx,%ecx
imul   %eax,%ecx
mov    %ecx,0x0(%rbp,%rbx,4)
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     132d <main+0x17d>
mov    0x14(%rsp),%edi
imul   0x10(%rsp),%edi
imul   0xc(%rsp),%edi
shl    $0x2,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1070 <get_time@plt>
mov    %rax,%r15
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %r14,%rdi
mov    %rbp,%r8
call   10c0 <videoSequence@plt>
xor    %eax,%eax
call   1070 <get_time@plt>
mov    %rax,%r12
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <elapsed_time@plt>
lea    0xd3f(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%r8
call   10d0 <particleFilter@plt>
xor    %eax,%eax
call   1070 <get_time@plt>
mov    %rax,%r13
mov    %r12,%rdi
mov    %rax,%rsi
call   1050 <elapsed_time@plt>
lea    0xd18(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <elapsed_time@plt>
lea    0xd18(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    1226 <main+0x76>
lea    0xd0d(%rip),%rdi
jmp    1221 <main+0x71>

LLVM IR (-O0):
@.str = [57 x i8] c"openmp.out -x <dimX> -y <dimY> -z <Nfr> -np <Nparticles>\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [3 x i8] c"-x\00"
@.str.3 = [3 x i8] c"-y\00"
@.str.4 = [3 x i8] c"-z\00"
@.str.5 = [4 x i8] c"-np\00"
@.str.6 = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.7 = [31 x i8] c"ERROR: dimX input is incorrect\00"
@.str.8 = [18 x i8] c"dimX must be > 0\0A\00"
@.str.9 = [31 x i8] c"ERROR: dimY input is incorrect\00"
@.str.10 = [18 x i8] c"dimY must be > 0\0A\00"
@.str.11 = [43 x i8] c"ERROR: Number of frames input is incorrect\00"
@.str.12 = [30 x i8] c"number of frames must be > 0\0A\00"
@.str.13 = [46 x i8] c"ERROR: Number of particles input is incorrect\00"
@.str.14 = [33 x i8] c"Number of particles must be > 0\0A\00"
@.str.15 = [24 x i8] c"VIDEO SEQUENCE TOOK %f\0A\00"
@.str.16 = [25 x i8] c"PARTICLE FILTER TOOK %f\0A\00"
@.str.17 = [24 x i8] c"ENTIRE PROGRAM TOOK %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8** %6
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 9
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = load i8*, i8** %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
store i32 0, i32* %3
br label %172
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp ne i64 %26, 0
br i1 %27, label %46, label %28
28: ; preds = %22
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %46, label %34
34: ; preds = %28
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 5
%37 = load i8*, i8** %36
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp ne i64 %38, 0
br i1 %39, label %46, label %40
40: ; preds = %34
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 7
%43 = load i8*, i8** %42
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %40, %34, %28, %22
%47 = load i8*, i8** %6
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %47)
store i32 0, i32* %3
br label %172
49: ; preds = %40
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 2
%52 = load i8*, i8** %51
%53 = call i64 @sscanf(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%54 = load i64, i64* @EOF
%55 = icmp eq i64 %53, %54
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %3
br label %172
58: ; preds = %49
%59 = load i32, i32* %7
%60 = icmp sle i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %3
br label %172
63: ; preds = %58
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 4
%66 = load i8*, i8** %65
%67 = call i64 @sscanf(i8* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %8)
%68 = load i64, i64* @EOF
%69 = icmp eq i64 %67, %68
br i1 %69, label %70, label %72
70: ; preds = %63
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %172
72: ; preds = %63
%73 = load i32, i32* %8
%74 = icmp sle i32 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %3
br label %172
77: ; preds = %72
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 6
%80 = load i8*, i8** %79
%81 = call i64 @sscanf(i8* %80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %9)
%82 = load i64, i64* @EOF
%83 = icmp eq i64 %81, %82
br i1 %83, label %84, label %86
84: ; preds = %77
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %3
br label %172
86: ; preds = %77
%87 = load i32, i32* %9
%88 = icmp sle i32 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %86
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %3
br label %172
91: ; preds = %86
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 8
%94 = load i8*, i8** %93
%95 = call i64 @sscanf(i8* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %10)
%96 = load i64, i64* @EOF
%97 = icmp eq i64 %95, %96
br i1 %97, label %98, label %100
98: ; preds = %91
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %3
br label %172
100: ; preds = %91
%101 = load i32, i32* %10
%102 = icmp sle i32 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %100
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %3
br label %172
105: ; preds = %100
%106 = load i32, i32* %10
%107 = sext i32 %106 to i64
%108 = mul i64 4, %107
%109 = trunc i64 %108 to i32
%110 = call i64 @malloc(i32 %109)
%111 = inttoptr i64 %110 to i32*
store i32* %111, i32** %11
store i32 0, i32* %12
br label %112
112: ; preds = %124, %105
%113 = load i32, i32* %12
%114 = load i32, i32* %10
%115 = icmp slt i32 %113, %114
br i1 %115, label %116, label %127
116: ; preds = %112
%117 = call i32 @time(i32 0)
%118 = load i32, i32* %12
%119 = mul nsw i32 %117, %118
%120 = load i32*, i32** %11
%121 = load i32, i32* %12
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i32, i32* %120, i64 %122
store i32 %119, i32* %123
br label %124
124: ; preds = %116
%125 = load i32, i32* %12
%126 = add nsw i32 %125, 1
store i32 %126, i32* %12
br label %112
127: ; preds = %112
%128 = load i32, i32* %7
%129 = sext i32 %128 to i64
%130 = mul i64 4, %129
%131 = load i32, i32* %8
%132 = sext i32 %131 to i64
%133 = mul i64 %130, %132
%134 = load i32, i32* %9
%135 = sext i32 %134 to i64
%136 = mul i64 %133, %135
%137 = trunc i64 %136 to i32
%138 = call i64 @malloc(i32 %137)
%139 = inttoptr i64 %138 to i32*
store i32* %139, i32** %13
%140 = call i64 (...) @get_time()
store i64 %140, i64* %14
%141 = load i32*, i32** %13
%142 = load i32, i32* %7
%143 = load i32, i32* %8
%144 = load i32, i32* %9
%145 = load i32*, i32** %11
%146 = call i32 @videoSequence(i32* %141, i32 %142, i32 %143, i32 %144, i32* %145)
%147 = call i64 (...) @get_time()
store i64 %147, i64* %15
%148 = load i64, i64* %14
%149 = load i64, i64* %15
%150 = call double @elapsed_time(i64 %148, i64 %149)
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), double %150)
%152 = load i32*, i32** %13
%153 = load i32, i32* %7
%154 = load i32, i32* %8
%155 = load i32, i32* %9
%156 = load i32*, i32** %11
%157 = load i32, i32* %10
%158 = call i32 @particleFilter(i32* %152, i32 %153, i32 %154, i32 %155, i32* %156, i32 %157)
%159 = call i64 (...) @get_time()
store i64 %159, i64* %16
%160 = load i64, i64* %15
%161 = load i64, i64* %16
%162 = call double @elapsed_time(i64 %160, i64 %161)
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), double %162)
%164 = load i64, i64* %14
%165 = load i64, i64* %16
%166 = call double @elapsed_time(i64 %164, i64 %165)
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), double %166)
%168 = load i32*, i32** %11
%169 = call i32 @free(i32* %168)
%170 = load i32*, i32** %13
%171 = call i32 @free(i32* %170)
store i32 0, i32* %3
br label %172
172: ; preds = %127, %103, %98, %89, %84, %75, %70, %61, %56, %46, %19
%173 = load i32, i32* %3
ret i32 %173
}

LLVM IR (-O2):
@.str = [57 x i8] c"openmp.out -x <dimX> -y <dimY> -z <Nfr> -np <Nparticles>\00"
@.str.2 = [3 x i8] c"-x\00"
@.str.3 = [3 x i8] c"-y\00"
@.str.4 = [3 x i8] c"-z\00"
@.str.5 = [4 x i8] c"-np\00"
@.str.6 = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.7 = [31 x i8] c"ERROR: dimX input is incorrect\00"
@.str.9 = [31 x i8] c"ERROR: dimY input is incorrect\00"
@.str.11 = [43 x i8] c"ERROR: Number of frames input is incorrect\00"
@.str.13 = [46 x i8] c"ERROR: Number of particles input is incorrect\00"
@.str.15 = [24 x i8] c"VIDEO SEQUENCE TOOK %f\0A\00"
@.str.16 = [25 x i8] c"PARTICLE FILTER TOOK %f\0A\00"
@.str.17 = [24 x i8] c"ENTIRE PROGRAM TOOK %f\0A\00"
@str = [32 x i8] c"Number of particles must be > 0\00"
@str.18 = [29 x i8] c"number of frames must be > 0\00"
@str.19 = [17 x i8] c"dimY must be > 0\00"
@str.20 = [17 x i8] c"dimX must be > 0\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = icmp eq i32 %0, 9
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
br label %134
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %30
15: ; preds = %10
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %15
%21 = getelementptr inbounds i8*, i8** %1, i64 5
%22 = load i8*, i8** %21
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = getelementptr inbounds i8*, i8** %1, i64 7
%27 = load i8*, i8** %26
%28 = tail call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %25, %20, %15, %10
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
br label %134
32: ; preds = %25
%33 = bitcast i32* %3 to i8*
%34 = bitcast i32* %4 to i8*
%35 = bitcast i32* %5 to i8*
%36 = bitcast i32* %6 to i8*
%37 = getelementptr inbounds i8*, i8** %1, i64 2
%38 = load i8*, i8** %37
%39 = call i64 @sscanf(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%40 = load i64, i64* @EOF
%41 = icmp eq i64 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %32
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %133
44: ; preds = %32
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 1
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.20, i64 0, i64 0))
br label %133
49: ; preds = %44
%50 = getelementptr inbounds i8*, i8** %1, i64 4
%51 = load i8*, i8** %50
%52 = call i64 @sscanf(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%53 = load i64, i64* @EOF
%54 = icmp eq i64 %52, %53
br i1 %54, label %55, label %57
55: ; preds = %49
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
br label %133
57: ; preds = %49
%58 = load i32, i32* %4
%59 = icmp slt i32 %58, 1
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.19, i64 0, i64 0))
br label %133
62: ; preds = %57
%63 = getelementptr inbounds i8*, i8** %1, i64 6
%64 = load i8*, i8** %63
%65 = call i64 @sscanf(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %5)
%66 = load i64, i64* @EOF
%67 = icmp eq i64 %65, %66
br i1 %67, label %68, label %70
68: ; preds = %62
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0))
br label %133
70: ; preds = %62
%71 = load i32, i32* %5
%72 = icmp slt i32 %71, 1
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.18, i64 0, i64 0))
br label %133
75: ; preds = %70
%76 = getelementptr inbounds i8*, i8** %1, i64 8
%77 = load i8*, i8** %76
%78 = call i64 @sscanf(i8* %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %6)
%79 = load i64, i64* @EOF
%80 = icmp eq i64 %78, %79
br i1 %80, label %81, label %83
81: ; preds = %75
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.13, i64 0, i64 0))
br label %133
83: ; preds = %75
%84 = load i32, i32* %6
%85 = icmp slt i32 %84, 1
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %133
88: ; preds = %83
%89 = shl i32 %84, 2
%90 = call i64 @malloc(i32 %89)
%91 = inttoptr i64 %90 to i32*
%92 = load i32, i32* %6
%93 = icmp sgt i32 %92, 0
br i1 %93, label %94, label %104
94: ; preds = %88, %94
%95 = phi i64 [ %100, %94 ], [ 0, %88 ]
%96 = call i32 @time(i32 0)
%97 = trunc i64 %95 to i32
%98 = mul nsw i32 %96, %97
%99 = getelementptr inbounds i32, i32* %91, i64 %95
store i32 %98, i32* %99
%100 = add nuw nsw i64 %95, 1
%101 = load i32, i32* %6
%102 = sext i32 %101 to i64
%103 = icmp slt i64 %100, %102
br i1 %103, label %94, label %104
104: ; preds = %94, %88
%105 = load i32, i32* %3
%106 = shl i32 %105, 2
%107 = load i32, i32* %4
%108 = mul i32 %106, %107
%109 = load i32, i32* %5
%110 = mul i32 %108, %109
%111 = call i64 @malloc(i32 %110)
%112 = inttoptr i64 %111 to i32*
%113 = call i64 (...) @get_time()
%114 = load i32, i32* %3
%115 = load i32, i32* %4
%116 = load i32, i32* %5
%117 = call i32 @videoSequence(i32* %112, i32 %114, i32 %115, i32 %116, i32* %91)
%118 = call i64 (...) @get_time()
%119 = call double @elapsed_time(i64 %113, i64 %118)
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), double %119)
%121 = load i32, i32* %3
%122 = load i32, i32* %4
%123 = load i32, i32* %5
%124 = load i32, i32* %6
%125 = call i32 @particleFilter(i32* %112, i32 %121, i32 %122, i32 %123, i32* %91, i32 %124)
%126 = call i64 (...) @get_time()
%127 = call double @elapsed_time(i64 %118, i64 %126)
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), double %127)
%129 = call double @elapsed_time(i64 %113, i64 %126)
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), double %129)
%131 = call i32 @free(i32* %91)
%132 = call i32 @free(i32* %112)
br label %133
133: ; preds = %104, %86, %81, %73, %68, %60, %55, %47, %42
br label %134
134: ; preds = %133, %30, %8
ret i32 0
}