#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;
unsigned long long current_time_ns();
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));
  const unsigned long long full_program_start = current_time_ns();
  particleFilter(I, IszX, IszY, Nfr, seed, Nparticles);
  const unsigned long long full_program_end = current_time_ns();
  printf("full_program %llu ns\n", full_program_end - full_program_start);
  ;
  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    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe33(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x9,-0x8(%rbp)
je     11f9 <main+0x49>
mov    -0x18(%rbp),%rsi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe35(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1271 <main+0xc1>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe1a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1271 <main+0xc1>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xdff(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1271 <main+0xc1>
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
lea    0xde4(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     128f <main+0xdf>
mov    -0x18(%rbp),%rsi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdac(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    0x2d3a(%rip),%rcx
cmp    (%rcx),%rax
jne    12d1 <main+0x121>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
cmpl   $0x0,-0x1c(%rbp)
jg     12f5 <main+0x145>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xd46(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    0x2cd4(%rip),%rcx
cmp    (%rcx),%rax
jne    1337 <main+0x187>
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
cmpl   $0x0,-0x20(%rbp)
jg     135b <main+0x1ab>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
lea    0xce0(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    0x2c6e(%rip),%rcx
cmp    (%rcx),%rax
jne    139d <main+0x1ed>
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
cmpl   $0x0,-0x24(%rbp)
jg     13c1 <main+0x211>
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rdi
lea    0xc7a(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   10a0 <sscanf@plt>
mov    0x2c08(%rip),%rcx
cmp    (%rcx),%rax
jne    1403 <main+0x253>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
cmpl   $0x0,-0x28(%rbp)
jg     1427 <main+0x277>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x3cd>
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    1473 <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    1441 <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    0xc71(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10c0 <current_time_ns@plt>
mov    %rax,-0x58(%rbp)
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   10d0 <particleFilter@plt>
mov    $0x0,%al
call   10c0 <current_time_ns@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rsi
sub    -0x58(%rbp),%rsi
lea    0xc43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <get_time@plt>
mov    %rax,-0x68(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1040 <elapsed_time@plt>
lea    0xc33(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1040 <elapsed_time@plt>
lea    0xc31(%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    $0x70,%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    122a <main+0x6a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe58(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    122a <main+0x6a>
mov    0x18(%rbx),%rdi
lea    0xe46(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    122a <main+0x6a>
mov    0x28(%rbx),%rdi
lea    0xe34(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    122a <main+0x6a>
mov    0x38(%rbx),%rdi
lea    0xe22(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1247 <main+0x87>
lea    0xdcf(%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    0xdf4(%rip),%rsi
lea    0x14(%rsp),%rdx
call   10b0 <sscanf@plt>
mov    0x2d85(%rip),%r14
cmp    (%r14),%rax
jne    1274 <main+0xb4>
lea    0xdda(%rip),%rdi
jmp    1305 <main+0x145>
cmpl   $0x0,0x14(%rsp)
jle    129e <main+0xde>
mov    0x20(%rbx),%rdi
lea    0xdc0(%rip),%rsi
lea    0x10(%rsp),%rdx
call   10b0 <sscanf@plt>
cmp    (%r14),%rax
jne    12a7 <main+0xe7>
lea    0xdcc(%rip),%rdi
jmp    1305 <main+0x145>
lea    0xee8(%rip),%rdi
jmp    1231 <main+0x71>
cmpl   $0x0,0x10(%rsp)
jle    12d1 <main+0x111>
mov    0x30(%rbx),%rdi
lea    0xd8d(%rip),%rsi
lea    0xc(%rsp),%rdx
call   10b0 <sscanf@plt>
cmp    (%r14),%rax
jne    12dd <main+0x11d>
lea    0xdb8(%rip),%rdi
jmp    1305 <main+0x145>
lea    0xea4(%rip),%rdi
jmp    1231 <main+0x71>
cmpl   $0x0,0xc(%rsp)
jle    1311 <main+0x151>
mov    0x40(%rbx),%rdi
lea    0xd57(%rip),%rsi
lea    0x8(%rsp),%rdx
call   10b0 <sscanf@plt>
cmp    (%r14),%rax
jne    131d <main+0x15d>
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1236 <main+0x76>
lea    0xe47(%rip),%rdi
jmp    1231 <main+0x71>
mov    0x8(%rsp),%edi
test   %edi,%edi
jle    144a <main+0x28a>
shl    $0x2,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbp
cmpl   $0x0,0x8(%rsp)
jle    135b <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     133d <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    0xd2f(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
call   10d0 <current_time_ns@plt>
mov    %rax,%r13
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r9d
mov    %r14,%rdi
mov    %rbp,%r8
call   10e0 <particleFilter@plt>
xor    %eax,%eax
call   10d0 <current_time_ns@plt>
sub    %r13,%rax
lea    0xd09(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <get_time@plt>
mov    %rax,%r13
mov    %r12,%rdi
mov    %rax,%rsi
call   1050 <elapsed_time@plt>
lea    0xcf9(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <elapsed_time@plt>
lea    0xcf9(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    1236 <main+0x76>
lea    0xcee(%rip),%rdi
jmp    1231 <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 = [22 x i8] c"full_program %llu ns\0A\00"
@.str.17 = [25 x i8] c"PARTICLE FILTER TOOK %f\0A\00"
@.str.18 = [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
%17 = alloca i64
%18 = 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
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 9
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = load i8*, i8** %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %22)
store i32 0, i32* %3
br label %180
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %48, label %30
30: ; preds = %24
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp ne i64 %34, 0
br i1 %35, label %48, label %36
36: ; preds = %30
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 5
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %48, label %42
42: ; preds = %36
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 7
%45 = load i8*, i8** %44
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %42, %36, %30, %24
%49 = load i8*, i8** %6
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %49)
store i32 0, i32* %3
br label %180
51: ; preds = %42
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i64 @sscanf(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%56 = load i64, i64* @EOF
%57 = icmp eq i64 %55, %56
br i1 %57, label %58, label %60
58: ; preds = %51
%59 = 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 %180
60: ; preds = %51
%61 = load i32, i32* %7
%62 = icmp sle i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = 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 %180
65: ; preds = %60
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 4
%68 = load i8*, i8** %67
%69 = call i64 @sscanf(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %8)
%70 = load i64, i64* @EOF
%71 = icmp eq i64 %69, %70
br i1 %71, label %72, label %74
72: ; preds = %65
%73 = 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 %180
74: ; preds = %65
%75 = load i32, i32* %8
%76 = icmp sle i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %74
%78 = 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 %180
79: ; preds = %74
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 6
%82 = load i8*, i8** %81
%83 = call i64 @sscanf(i8* %82, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %9)
%84 = load i64, i64* @EOF
%85 = icmp eq i64 %83, %84
br i1 %85, label %86, label %88
86: ; preds = %79
%87 = 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 %180
88: ; preds = %79
%89 = load i32, i32* %9
%90 = icmp sle i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %88
%92 = 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 %180
93: ; preds = %88
%94 = load i8**, i8*** %5
%95 = getelementptr inbounds i8*, i8** %94, i64 8
%96 = load i8*, i8** %95
%97 = call i64 @sscanf(i8* %96, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %10)
%98 = load i64, i64* @EOF
%99 = icmp eq i64 %97, %98
br i1 %99, label %100, label %102
100: ; preds = %93
%101 = 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 %180
102: ; preds = %93
%103 = load i32, i32* %10
%104 = icmp sle i32 %103, 0
br i1 %104, label %105, label %107
105: ; preds = %102
%106 = 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 %180
107: ; preds = %102
%108 = load i32, i32* %10
%109 = sext i32 %108 to i64
%110 = mul i64 4, %109
%111 = trunc i64 %110 to i32
%112 = call i64 @malloc(i32 %111)
%113 = inttoptr i64 %112 to i32*
store i32* %113, i32** %11
store i32 0, i32* %12
br label %114
114: ; preds = %126, %107
%115 = load i32, i32* %12
%116 = load i32, i32* %10
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %129
118: ; preds = %114
%119 = call i32 @time(i32 0)
%120 = load i32, i32* %12
%121 = mul nsw i32 %119, %120
%122 = load i32*, i32** %11
%123 = load i32, i32* %12
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %122, i64 %124
store i32 %121, i32* %125
br label %126
126: ; preds = %118
%127 = load i32, i32* %12
%128 = add nsw i32 %127, 1
store i32 %128, i32* %12
br label %114
129: ; preds = %114
%130 = load i32, i32* %7
%131 = sext i32 %130 to i64
%132 = mul i64 4, %131
%133 = load i32, i32* %8
%134 = sext i32 %133 to i64
%135 = mul i64 %132, %134
%136 = load i32, i32* %9
%137 = sext i32 %136 to i64
%138 = mul i64 %135, %137
%139 = trunc i64 %138 to i32
%140 = call i64 @malloc(i32 %139)
%141 = inttoptr i64 %140 to i32*
store i32* %141, i32** %13
%142 = call i64 (...) @get_time()
store i64 %142, i64* %14
%143 = load i32*, i32** %13
%144 = load i32, i32* %7
%145 = load i32, i32* %8
%146 = load i32, i32* %9
%147 = load i32*, i32** %11
%148 = call i32 @videoSequence(i32* %143, i32 %144, i32 %145, i32 %146, i32* %147)
%149 = call i64 (...) @get_time()
store i64 %149, i64* %15
%150 = load i64, i64* %14
%151 = load i64, i64* %15
%152 = call double @elapsed_time(i64 %150, i64 %151)
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), double %152)
%154 = call i64 (...) @current_time_ns()
store i64 %154, i64* %16
%155 = load i32*, i32** %13
%156 = load i32, i32* %7
%157 = load i32, i32* %8
%158 = load i32, i32* %9
%159 = load i32*, i32** %11
%160 = load i32, i32* %10
%161 = call i32 @particleFilter(i32* %155, i32 %156, i32 %157, i32 %158, i32* %159, i32 %160)
%162 = call i64 (...) @current_time_ns()
store i64 %162, i64* %17
%163 = load i64, i64* %17
%164 = load i64, i64* %16
%165 = sub i64 %163, %164
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), i64 %165)
%167 = call i64 (...) @get_time()
store i64 %167, i64* %18
%168 = load i64, i64* %15
%169 = load i64, i64* %18
%170 = call double @elapsed_time(i64 %168, i64 %169)
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0), double %170)
%172 = load i64, i64* %14
%173 = load i64, i64* %18
%174 = call double @elapsed_time(i64 %172, i64 %173)
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), double %174)
%176 = load i32*, i32** %11
%177 = call i32 @free(i32* %176)
%178 = load i32*, i32** %13
%179 = call i32 @free(i32* %178)
store i32 0, i32* %3
br label %180
180: ; preds = %129, %105, %100, %91, %86, %77, %72, %63, %58, %48, %21
%181 = load i32, i32* %3
ret i32 %181
}

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 = [22 x i8] c"full_program %llu ns\0A\00"
@.str.17 = [25 x i8] c"PARTICLE FILTER TOOK %f\0A\00"
@.str.18 = [24 x i8] c"ENTIRE PROGRAM TOOK %f\0A\00"
@str = [32 x i8] c"Number of particles must be > 0\00"
@str.19 = [29 x i8] c"number of frames must be > 0\00"
@str.20 = [17 x i8] c"dimY must be > 0\00"
@str.21 = [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 %138
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 %138
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 %137
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.21, i64 0, i64 0))
br label %137
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 %137
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.20, i64 0, i64 0))
br label %137
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 %137
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.19, i64 0, i64 0))
br label %137
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 %137
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 %137
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 = call i64 (...) @current_time_ns()
%122 = load i32, i32* %3
%123 = load i32, i32* %4
%124 = load i32, i32* %5
%125 = load i32, i32* %6
%126 = call i32 @particleFilter(i32* %112, i32 %122, i32 %123, i32 %124, i32* %91, i32 %125)
%127 = call i64 (...) @current_time_ns()
%128 = sub i64 %127, %121
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), i64 %128)
%130 = call i64 (...) @get_time()
%131 = call double @elapsed_time(i64 %118, i64 %130)
%132 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.17, i64 0, i64 0), double %131)
%133 = call double @elapsed_time(i64 %113, i64 %130)
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), double %133)
%135 = call i32 @free(i32* %91)
%136 = call i32 @free(i32* %112)
br label %137
137: ; preds = %104, %86, %81, %73, %68, %60, %55, %47, %42
br label %138
138: ; preds = %137, %30, %8
ret i32 0
}