#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 */
struct timezone {
  int dummy;
};
struct timeval {
  int tv_sec;
  int tv_usec;
};
typedef int /*<<< orphan*/ omp_lock_t;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
scalar_t__ malloc(int);
int /*<<< orphan*/ omp_destroy_lock(int /*<<< orphan*/ *);
int /*<<< orphan*/ omp_init_lock(int /*<<< orphan*/ *);
int /*<<< orphan*/ omp_set_lock(int /*<<< orphan*/ *);
int /*<<< orphan*/ omp_set_num_threads(int);
int /*<<< orphan*/ omp_unset_lock(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int);
main(int argc, char **argv) {
  int *array, i, Noofelements, cur_max, current_value, Noofthreads;
  struct timeval TimeValue_Start;
  struct timezone TimeZone_Start;
  struct timeval TimeValue_Final;
  struct timezone TimeZone_Final;
  long time_start, time_end;
  double time_overhead;
  omp_lock_t MAXLOCK;
  printf("\n\t\t---------------------------------------------------------------"
         "------------");
  printf("\n\t\t Email : RarchK");
  printf("\n\t\t---------------------------------------------------------------"
         "------------");
  printf("\n\t\t Objective : Finding Maximum element of an Array ");
  printf("\n\t\t This example demonstrates the use of OpenMP Lock routines "
         "such as : omp_init_lock()");
  printf("\n\t\t omp_set_lock(),omp_unset_lock(), omp_destroy_lock(). ");
  printf("\n\t\t..............................................................."
         "...........\n");
  if (argc != 3) {
    printf("\t\t Very Few Arguments\n ");
    printf("\t\t Syntax : exec <Threads>  <No. of elements> \n");
    exit(-1);
  }
  Noofthreads = atoi(argv[1]);
  if ((Noofthreads != 1) && (Noofthreads != 2) && (Noofthreads != 4) &&
      (Noofthreads != 8) && (Noofthreads != 16)) {
    printf("\n Number of threads should be 1,2,4,8 or 16 for the execution of "
           "program. \n\n");
    exit(-1);
  }
  Noofelements = atoi(argv[2]);
  printf("\n\t\t Threads : %d", Noofthreads);
  printf("\n\t\t Number of elements in Array : %d \n ", Noofelements);
  if (Noofelements <= 0) {
    printf("\n\t\t The array elements cannot be stored\n");
    exit(1);
  }
  array = (int *)malloc(sizeof(int) * Noofelements);
  srand(65535);
  for (i = 0; i < Noofelements; i++)
    array[i] = rand();
  if (Noofelements == 1) {
    printf("\n\t\t The Largest Element In The Array Is %d", array[0]);
    exit(1);
  }
  gettimeofday(&TimeValue_Start, &TimeZone_Start);
  omp_set_num_threads(Noofthreads);
  omp_init_lock(&MAXLOCK);
  cur_max = -9999;
#pragma omp parallel for
  for (i = 0; i < Noofelements; i = i + 1) {
    if (array[i] > cur_max) {
      omp_set_lock(&MAXLOCK);
      if (array[i] > cur_max)
        cur_max = array[i];
      omp_unset_lock(&MAXLOCK);
    }
  }
  omp_destroy_lock(&MAXLOCK);
  gettimeofday(&TimeValue_Final, &TimeZone_Final);
  time_start = TimeValue_Start.tv_sec * 1000000 + TimeValue_Start.tv_usec;
  time_end = TimeValue_Final.tv_sec * 1000000 + TimeValue_Final.tv_usec;
  time_overhead = (time_end - time_start) / 1000000.0;
  current_value = array[0];
  for (i = 1; i < Noofelements; i++)
    if (array[i] > current_value)
      current_value = array[i];
  if (current_value == cur_max)
    printf("\n\n\t\t The Max Value Is Same For Serial And Using Parallel "
           "OpenMP Directive\n");
  else {
    printf("\n\n\t\t The Max Value Is Not Same In Serial And Using Parallel "
           "OpenMP Directive\n");
    exit(-1);
  }
  free(array);
  printf("\n\t\t The Largest Number Of The Array Is %d\n", cur_max);
  printf("\n\t\t Time in Seconds (T)        : %lf Seconds \n", time_overhead);
  printf("\n\t\t..............................................................."
         "...........\n");
}


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    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
je     1278 <main+0xa8>
lea    0xf27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf31(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
je     12d2 <main+0x102>
cmpl   $0x2,-0x2c(%rbp)
je     12d2 <main+0x102>
cmpl   $0x4,-0x2c(%rbp)
je     12d2 <main+0x102>
cmpl   $0x8,-0x2c(%rbp)
je     12d2 <main+0x102>
cmpl   $0x10,-0x2c(%rbp)
je     12d2 <main+0x102>
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
jg     1326 <main+0x156>
lea    0xf39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0xffff,%edi
call   1070 <srand@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1378 <main+0x1a8>
mov    $0x0,%al
call   10f0 <rand@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    134a <main+0x17a>
cmpl   $0x1,-0x20(%rbp)
jne    13a0 <main+0x1d0>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    -0x38(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1060 <gettimeofday@plt>
mov    -0x2c(%rbp),%edi
call   10a0 <omp_set_num_threads@plt>
lea    -0x6c(%rbp),%rdi
call   10d0 <omp_init_lock@plt>
movl   $0xffffd8f1,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1433 <main+0x263>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x24(%rbp),%eax
jle    1420 <main+0x250>
lea    -0x6c(%rbp),%rdi
call   1080 <omp_set_lock@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x24(%rbp),%eax
jle    1417 <main+0x247>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
lea    -0x6c(%rbp),%rdi
call   1040 <omp_unset_lock@plt>
jmp    1425 <main+0x255>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13cc <main+0x1fc>
lea    -0x6c(%rbp),%rdi
call   10e0 <omp_destroy_lock@plt>
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1060 <gettimeofday@plt>
imul   $0xf4240,-0x38(%rbp),%eax
add    -0x34(%rbp),%eax
cltq
mov    %rax,-0x58(%rbp)
imul   $0xf4240,-0x48(%rbp),%eax
add    -0x44(%rbp),%eax
cltq
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
sub    -0x58(%rbp),%rax
cvtsi2sd %rax,%xmm0
movsd  0xb82(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    14d8 <main+0x308>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jle    14c5 <main+0x2f5>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x28(%rbp)
jmp    14ca <main+0x2fa>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1497 <main+0x2c7>
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    14f7 <main+0x327>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    150f <main+0x33f>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%esi
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x68(%rbp),%xmm0
lea    0xe31(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xbee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
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    $0x38,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0xe0d(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe4b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe46(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x1050(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x3,%r14d
jne    15b8 <main+0x3d8>
mov    0x8(%rbx),%rdi
call   10c0 <atoi@plt>
cmp    $0x10,%eax
ja     1615 <main+0x435>
mov    %eax,%r15d
mov    $0x10116,%eax
bt     %r15d,%eax
jae    1615 <main+0x435>
mov    0x10(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %eax,%r14d
lea    0xeb5(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r14d,%r14d
jle    15cf <main+0x3ef>
lea    0x0(,%r14,4),%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    $0xffff,%edi
call   1080 <srand@plt>
mov    %r14d,%r13d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1100 <rand@plt>
mov    %eax,(%rbx,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%r13
jne    12e0 <main+0x100>
cmp    $0x1,%r14d
je     15e5 <main+0x405>
lea    0x18(%rsp),%rdi
lea    0x30(%rsp),%rsi
call   1070 <gettimeofday@plt>
mov    %r15d,%edi
call   10b0 <omp_set_num_threads@plt>
lea    0xc(%rsp),%rdi
call   10e0 <omp_init_lock@plt>
mov    $0xffffd8f1,%r12d
test   %r14d,%r14d
jle    136b <main+0x18b>
xor    %ebp,%ebp
lea    0xc(%rsp),%r15
jmp    1349 <main+0x169>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    %rbp,%r13
je     136b <main+0x18b>
cmp    %r12d,(%rbx,%rbp,4)
jle    1340 <main+0x160>
mov    %r15,%rdi
call   1090 <omp_set_lock@plt>
mov    (%rbx,%rbp,4),%eax
cmp    %r12d,%eax
cmovg  %eax,%r12d
mov    %r15,%rdi
call   1050 <omp_unset_lock@plt>
jmp    1340 <main+0x160>
lea    0xc(%rsp),%rdi
call   10f0 <omp_destroy_lock@plt>
lea    0x10(%rsp),%rdi
lea    0x28(%rsp),%rsi
call   1070 <gettimeofday@plt>
mov    (%rbx),%edx
cmp    $0x2,%r14d
jl     1501 <main+0x321>
lea    -0x1(%r13),%rcx
mov    $0x1,%eax
cmp    $0x8,%rcx
jb     14f0 <main+0x310>
mov    %rcx,%rax
and    $0xfffffffffffffff8,%rax
movd   %edx,%xmm0
pshufd $0x0,%xmm0,%xmm0
lea    -0x8(%rax),%rsi
mov    %rsi,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     15a1 <main+0x3c1>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0x1,%esi
movdqa %xmm0,%xmm1
nopl   0x0(%rax,%rax,1)
movdqu (%rbx,%rsi,4),%xmm2
movdqu 0x10(%rbx,%rsi,4),%xmm3
movdqu 0x20(%rbx,%rsi,4),%xmm4
movdqu 0x30(%rbx,%rsi,4),%xmm5
movdqa %xmm2,%xmm6
pcmpgtd %xmm0,%xmm6
pand   %xmm6,%xmm2
pandn  %xmm0,%xmm6
por    %xmm2,%xmm6
movdqa %xmm3,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm3
pandn  %xmm1,%xmm2
por    %xmm3,%xmm2
movdqa %xmm4,%xmm0
pcmpgtd %xmm6,%xmm0
pand   %xmm0,%xmm4
pandn  %xmm6,%xmm0
por    %xmm4,%xmm0
movdqa %xmm5,%xmm1
pcmpgtd %xmm2,%xmm1
pand   %xmm1,%xmm5
pandn  %xmm2,%xmm1
por    %xmm5,%xmm1
add    $0x10,%rsi
add    $0xfffffffffffffffe,%rdi
jne    13e0 <main+0x200>
test   $0x1,%dl
je     1491 <main+0x2b1>
movdqu (%rbx,%rsi,4),%xmm2
movdqu 0x10(%rbx,%rsi,4),%xmm3
movdqa %xmm2,%xmm4
pcmpgtd %xmm0,%xmm4
pand   %xmm4,%xmm2
pandn  %xmm0,%xmm4
por    %xmm2,%xmm4
movdqa %xmm3,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm3
pandn  %xmm1,%xmm2
por    %xmm3,%xmm2
movdqa %xmm4,%xmm0
movdqa %xmm2,%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm1,%xmm2
pand   %xmm2,%xmm0
pandn  %xmm1,%xmm2
por    %xmm0,%xmm2
pshufd $0xee,%xmm2,%xmm0
movdqa %xmm2,%xmm1
pcmpgtd %xmm0,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm0,%xmm1
por    %xmm2,%xmm1
pshufd $0x55,%xmm1,%xmm0
movdqa %xmm1,%xmm2
pcmpgtd %xmm0,%xmm2
pand   %xmm2,%xmm1
pandn  %xmm0,%xmm2
por    %xmm1,%xmm2
movd   %xmm2,%edx
cmp    %rax,%rcx
je     1501 <main+0x321>
or     $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx,%rax,4),%ecx
cmp    %edx,%ecx
cmovg  %ecx,%edx
add    $0x1,%rax
cmp    %rax,%r13
jne    14f0 <main+0x310>
cmp    %r12d,%edx
jne    15ff <main+0x41f>
movslq 0x18(%rsp),%rax
movslq 0x1c(%rsp),%rcx
movslq 0x10(%rsp),%rdx
movslq 0x14(%rsp),%rsi
imul   $0xf4240,%rdx,%rdx
add    %rsi,%rdx
imul   $0xf4240,%rax,%rax
add    %rcx,%rax
sub    %rax,%rdx
xorps  %xmm0,%xmm0
cvtsi2sd %rdx,%xmm0
divsd  0xabb(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0xd02(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xc47(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc61(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xd13(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%esi
movdqa %xmm0,%xmm1
test   $0x1,%dl
jne    1456 <main+0x276>
jmp    1491 <main+0x2b1>
lea    0xb72(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd93(%rip),%rdi
jmp    1606 <main+0x426>
lea    0xd16(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    (%rbx),%esi
lea    0xb94(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xc01(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
lea    0xcf8(%rip),%rdi
jmp    1606 <main+0x426>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
@.str = [79 x i8] c"\0A\09\09---------------------------------------------------------------------------\00"
@.str.1 = [19 x i8] c"\0A\09\09 Email : RarchK\00"
@.str.2 = [53 x i8] c"\0A\09\09 Objective : Finding Maximum element of an Array \00"
@.str.3 = [88 x i8] c"\0A\09\09 This example demonstrates the use of OpenMP Lock routines such as : omp_init_lock()\00"
@.str.4 = [58 x i8] c"\0A\09\09 omp_set_lock(),omp_unset_lock(), omp_destroy_lock(). \00"
@.str.5 = [79 x i8] c"\0A\09\09..........................................................................\0A\00"
@.str.6 = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.7 = [48 x i8] c"\09\09 Syntax : exec <Threads> <No. of elements> \0A\00"
@.str.8 = [77 x i8] c"\0A Number of threads should be 1,2,4,8 or 16 for the execution of program. \0A\0A\00"
@.str.9 = [17 x i8] c"\0A\09\09 Threads : %d\00"
@.str.10 = [40 x i8] c"\0A\09\09 Number of elements in Array : %d \0A \00"
@.str.11 = [41 x i8] c"\0A\09\09 The array elements cannot be stored\0A\00"
@.str.12 = [43 x i8] c"\0A\09\09 The Largest Element In The Array Is %d\00"
@.str.13 = [75 x i8] c"\0A\0A\09\09 The Max Value Is Same For Serial And Using Parallel OpenMP Directive\0A\00"
@.str.14 = [78 x i8] c"\0A\0A\09\09 The Max Value Is Not Same In Serial And Using Parallel OpenMP Directive\0A\00"
@.str.15 = [43 x i8] c"\0A\09\09 The Largest Number Of The Array Is %d\0A\00"
@.str.16 = [47 x i8] c"\0A\09\09 Time in Seconds (T) : %lf Seconds \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 i32
%12 = alloca %struct.timeval
%13 = alloca %struct.timezone
%14 = alloca %struct.timeval
%15 = alloca %struct.timezone
%16 = alloca i64
%17 = alloca i64
%18 = alloca double
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.3, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.5, i64 0, i64 0))
%27 = load i32, i32* %4
%28 = icmp ne i32 %27, 3
br i1 %28, label %29, label %33
29: ; preds = %2
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0))
%32 = call i32 @exit(i32 -1)
unreachable
33: ; preds = %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %11
%38 = load i32, i32* %11
%39 = icmp ne i32 %38, 1
br i1 %39, label %40, label %55
40: ; preds = %33
%41 = load i32, i32* %11
%42 = icmp ne i32 %41, 2
br i1 %42, label %43, label %55
43: ; preds = %40
%44 = load i32, i32* %11
%45 = icmp ne i32 %44, 4
br i1 %45, label %46, label %55
46: ; preds = %43
%47 = load i32, i32* %11
%48 = icmp ne i32 %47, 8
br i1 %48, label %49, label %55
49: ; preds = %46
%50 = load i32, i32* %11
%51 = icmp ne i32 %50, 16
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.8, i64 0, i64 0))
%54 = call i32 @exit(i32 -1)
unreachable
55: ; preds = %49, %46, %43, %40, %33
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 2
%58 = load i8*, i8** %57
%59 = call i32 @atoi(i8* %58)
store i32 %59, i32* %8
%60 = load i32, i32* %11
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %8
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %8
%65 = icmp sle i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %55
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %55
%70 = load i32, i32* %8
%71 = sext i32 %70 to i64
%72 = mul i64 4, %71
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to i32*
store i32* %75, i32** %6
%76 = call i32 @srand(i32 65535)
store i32 0, i32* %7
br label %77
77: ; preds = %87, %69
%78 = load i32, i32* %7
%79 = load i32, i32* %8
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %90
81: ; preds = %77
%82 = call i32 (...) @rand()
%83 = load i32*, i32** %6
%84 = load i32, i32* %7
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i32, i32* %83, i64 %85
store i32 %82, i32* %86
br label %87
87: ; preds = %81
%88 = load i32, i32* %7
%89 = add nsw i32 %88, 1
store i32 %89, i32* %7
br label %77
90: ; preds = %77
%91 = load i32, i32* %8
%92 = icmp eq i32 %91, 1
br i1 %92, label %93, label %99
93: ; preds = %90
%94 = load i32*, i32** %6
%95 = getelementptr inbounds i32, i32* %94, i64 0
%96 = load i32, i32* %95
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0), i32 %96)
%98 = call i32 @exit(i32 1)
unreachable
99: ; preds = %90
%100 = call i32 @gettimeofday(%struct.timeval* %12, %struct.timezone* %13)
%101 = load i32, i32* %11
%102 = call i32 @omp_set_num_threads(i32 %101)
%103 = call i32 @omp_init_lock(i32* %19)
store i32 -9999, i32* %9
store i32 0, i32* %7
br label %104
104: ; preds = %134, %99
%105 = load i32, i32* %7
%106 = load i32, i32* %8
%107 = icmp slt i32 %105, %106
br i1 %107, label %108, label %137
108: ; preds = %104
%109 = load i32*, i32** %6
%110 = load i32, i32* %7
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i32, i32* %109, i64 %111
%113 = load i32, i32* %112
%114 = load i32, i32* %9
%115 = icmp sgt i32 %113, %114
br i1 %115, label %116, label %133
116: ; preds = %108
%117 = call i32 @omp_set_lock(i32* %19)
%118 = load i32*, i32** %6
%119 = load i32, i32* %7
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i32, i32* %118, i64 %120
%122 = load i32, i32* %121
%123 = load i32, i32* %9
%124 = icmp sgt i32 %122, %123
br i1 %124, label %125, label %131
125: ; preds = %116
%126 = load i32*, i32** %6
%127 = load i32, i32* %7
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i32, i32* %126, i64 %128
%130 = load i32, i32* %129
store i32 %130, i32* %9
br label %131
131: ; preds = %125, %116
%132 = call i32 @omp_unset_lock(i32* %19)
br label %133
133: ; preds = %131, %108
br label %134
134: ; preds = %133
%135 = load i32, i32* %7
%136 = add nsw i32 %135, 1
store i32 %136, i32* %7
br label %104
137: ; preds = %104
%138 = call i32 @omp_destroy_lock(i32* %19)
%139 = call i32 @gettimeofday(%struct.timeval* %14, %struct.timezone* %15)
%140 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%141 = load i32, i32* %140
%142 = mul nsw i32 %141, 1000000
%143 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%144 = load i32, i32* %143
%145 = add nsw i32 %142, %144
%146 = sext i32 %145 to i64
store i64 %146, i64* %16
%147 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%148 = load i32, i32* %147
%149 = mul nsw i32 %148, 1000000
%150 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%151 = load i32, i32* %150
%152 = add nsw i32 %149, %151
%153 = sext i32 %152 to i64
store i64 %153, i64* %17
%154 = load i64, i64* %17
%155 = load i64, i64* %16
%156 = sub nsw i64 %154, %155
%157 = sitofp i64 %156 to double
%158 = fdiv double %157, 1.000000e+06
store double %158, double* %18
%159 = load i32*, i32** %6
%160 = getelementptr inbounds i32, i32* %159, i64 0
%161 = load i32, i32* %160
store i32 %161, i32* %10
store i32 1, i32* %7
br label %162
162: ; preds = %181, %137
%163 = load i32, i32* %7
%164 = load i32, i32* %8
%165 = icmp slt i32 %163, %164
br i1 %165, label %166, label %184
166: ; preds = %162
%167 = load i32*, i32** %6
%168 = load i32, i32* %7
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds i32, i32* %167, i64 %169
%171 = load i32, i32* %170
%172 = load i32, i32* %10
%173 = icmp sgt i32 %171, %172
br i1 %173, label %174, label %180
174: ; preds = %166
%175 = load i32*, i32** %6
%176 = load i32, i32* %7
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i32, i32* %175, i64 %177
%179 = load i32, i32* %178
store i32 %179, i32* %10
br label %180
180: ; preds = %174, %166
br label %181
181: ; preds = %180
%182 = load i32, i32* %7
%183 = add nsw i32 %182, 1
store i32 %183, i32* %7
br label %162
184: ; preds = %162
%185 = load i32, i32* %10
%186 = load i32, i32* %9
%187 = icmp eq i32 %185, %186
br i1 %187, label %188, label %190
188: ; preds = %184
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.13, i64 0, i64 0))
br label %193
190: ; preds = %184
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.14, i64 0, i64 0))
%192 = call i32 @exit(i32 -1)
unreachable
193: ; preds = %188
%194 = load i32*, i32** %6
%195 = call i32 @free(i32* %194)
%196 = load i32, i32* %9
%197 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.15, i64 0, i64 0), i32 %196)
%198 = load double, double* %18
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0), double %198)
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.5, i64 0, i64 0))
%201 = load i32, i32* %3
ret i32 %201
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
@.str = [79 x i8] c"\0A\09\09---------------------------------------------------------------------------\00"
@.str.1 = [19 x i8] c"\0A\09\09 Email : RarchK\00"
@.str.2 = [53 x i8] c"\0A\09\09 Objective : Finding Maximum element of an Array \00"
@.str.3 = [88 x i8] c"\0A\09\09 This example demonstrates the use of OpenMP Lock routines such as : omp_init_lock()\00"
@.str.4 = [58 x i8] c"\0A\09\09 omp_set_lock(),omp_unset_lock(), omp_destroy_lock(). \00"
@.str.6 = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.9 = [17 x i8] c"\0A\09\09 Threads : %d\00"
@.str.10 = [40 x i8] c"\0A\09\09 Number of elements in Array : %d \0A \00"
@.str.12 = [43 x i8] c"\0A\09\09 The Largest Element In The Array Is %d\00"
@.str.15 = [43 x i8] c"\0A\09\09 The Largest Number Of The Array Is %d\0A\00"
@.str.16 = [47 x i8] c"\0A\09\09 Time in Seconds (T) : %lf Seconds \0A\00"
@str.17 = [77 x i8] c"\0A\0A\09\09 The Max Value Is Not Same In Serial And Using Parallel OpenMP Directive\00"
@str.18 = [74 x i8] c"\0A\0A\09\09 The Max Value Is Same For Serial And Using Parallel OpenMP Directive\00"
@str.19 = [78 x i8] c"\0A\09\09..........................................................................\00"
@str.20 = [40 x i8] c"\0A\09\09 The array elements cannot be stored\00"
@str.21 = [76 x i8] c"\0A Number of threads should be 1,2,4,8 or 16 for the execution of program. \0A\00"
@str.22 = [47 x i8] c"\09\09 Syntax : exec <Threads> <No. of elements> \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timezone
%5 = alloca %struct.timeval
%6 = alloca %struct.timezone
%7 = alloca i32
%8 = bitcast %struct.timeval* %3 to i8*
%9 = bitcast %struct.timezone* %4 to i8*
%10 = bitcast %struct.timeval* %5 to i8*
%11 = bitcast %struct.timezone* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.19, i64 0, i64 0))
%20 = icmp eq i32 %0, 3
br i1 %20, label %25, label %21
21: ; preds = %2
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.22, i64 0, i64 0))
%24 = tail call i32 @exit(i32 -1)
unreachable
25: ; preds = %2
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = tail call i32 @atoi(i8* %27)
switch i32 %28, label %29 [
i32 16, label %32
i32 8, label %32
i32 4, label %32
i32 2, label %32
i32 1, label %32
]
29: ; preds = %25
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str.21, i64 0, i64 0))
%31 = tail call i32 @exit(i32 -1)
unreachable
32: ; preds = %25, %25, %25, %25, %25
%33 = getelementptr inbounds i8*, i8** %1, i64 2
%34 = load i8*, i8** %33
%35 = tail call i32 @atoi(i8* %34)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 %28)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), i32 %35)
%38 = icmp slt i32 %35, 1
br i1 %38, label %39, label %42
39: ; preds = %32
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.20, i64 0, i64 0))
%41 = tail call i32 @exit(i32 1)
unreachable
42: ; preds = %32
%43 = shl i32 %35, 2
%44 = tail call i64 @malloc(i32 %43)
%45 = inttoptr i64 %44 to i32*
%46 = tail call i32 @srand(i32 65535)
%47 = zext i32 %35 to i64
br label %48
48: ; preds = %42, %48
%49 = phi i64 [ 0, %42 ], [ %52, %48 ]
%50 = tail call i32 (...) @rand()
%51 = getelementptr inbounds i32, i32* %45, i64 %49
store i32 %50, i32* %51
%52 = add nuw nsw i64 %49, 1
%53 = icmp eq i64 %52, %47
br i1 %53, label %54, label %48
54: ; preds = %48
%55 = icmp eq i32 %35, 1
br i1 %55, label %56, label %60
56: ; preds = %54
%57 = load i32, i32* %45
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0), i32 %57)
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %54
%61 = call i32 @gettimeofday(%struct.timeval* %3, %struct.timezone* %4)
%62 = tail call i32 @omp_set_num_threads(i32 %28)
%63 = call i32 @omp_init_lock(i32* %7)
%64 = icmp sgt i32 %35, 0
br i1 %64, label %65, label %83
65: ; preds = %60
%66 = zext i32 %35 to i64
br label %67
67: ; preds = %65, %79
%68 = phi i64 [ 0, %65 ], [ %81, %79 ]
%69 = phi i32 [ -9999, %65 ], [ %80, %79 ]
%70 = getelementptr inbounds i32, i32* %45, i64 %68
%71 = load i32, i32* %70
%72 = icmp sgt i32 %71, %69
br i1 %72, label %73, label %79
73: ; preds = %67
%74 = call i32 @omp_set_lock(i32* %7)
%75 = load i32, i32* %70
%76 = icmp sgt i32 %75, %69
%77 = select i1 %76, i32 %75, i32 %69
%78 = call i32 @omp_unset_lock(i32* %7)
br label %79
79: ; preds = %67, %73
%80 = phi i32 [ %77, %73 ], [ %69, %67 ]
%81 = add nuw nsw i64 %68, 1
%82 = icmp eq i64 %81, %66
br i1 %82, label %83, label %67
83: ; preds = %79, %60
%84 = phi i32 [ -9999, %60 ], [ %80, %79 ]
%85 = call i32 @omp_destroy_lock(i32* %7)
%86 = call i32 @gettimeofday(%struct.timeval* %5, %struct.timezone* %6)
%87 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%88 = load i32, i32* %87
%89 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%90 = load i32, i32* %89
%91 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%92 = load i32, i32* %91
%93 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%94 = load i32, i32* %93
%95 = load i32, i32* %45
%96 = icmp sgt i32 %35, 1
br i1 %96, label %97, label %182
97: ; preds = %83
%98 = zext i32 %35 to i64
%99 = add nsw i64 %47, -1
%100 = icmp ult i64 %99, 8
br i1 %100, label %170, label %101
101: ; preds = %97
%102 = and i64 %99, -8
%103 = or i64 %102, 1
%104 = insertelement <4 x i32> poison, i32 %95, i64 0
%105 = shufflevector <4 x i32> %104, <4 x i32> poison, <4 x i32> zeroinitializer
%106 = add nsw i64 %102, -8
%107 = lshr exact i64 %106, 3
%108 = add nuw nsw i64 %107, 1
%109 = and i64 %108, 1
%110 = icmp eq i64 %106, 0
br i1 %110, label %145, label %111
111: ; preds = %101
%112 = and i64 %108, 4611686018427387902
br label %113
113: ; preds = %113, %111
%114 = phi i64 [ 0, %111 ], [ %140, %113 ]
%115 = phi <4 x i32> [ %105, %111 ], [ %138, %113 ]
%116 = phi <4 x i32> [ %105, %111 ], [ %139, %113 ]
%117 = phi i64 [ 0, %111 ], [ %141, %113 ]
%118 = or i64 %114, 1
%119 = getelementptr inbounds i32, i32* %45, i64 %118
%120 = bitcast i32* %119 to <4 x i32>*
%121 = load <4 x i32>, <4 x i32>* %120
%122 = getelementptr inbounds i32, i32* %119, i64 4
%123 = bitcast i32* %122 to <4 x i32>*
%124 = load <4 x i32>, <4 x i32>* %123
%125 = icmp sgt <4 x i32> %121, %115
%126 = icmp sgt <4 x i32> %124, %116
%127 = select <4 x i1> %125, <4 x i32> %121, <4 x i32> %115
%128 = select <4 x i1> %126, <4 x i32> %124, <4 x i32> %116
%129 = or i64 %114, 9
%130 = getelementptr inbounds i32, i32* %45, i64 %129
%131 = bitcast i32* %130 to <4 x i32>*
%132 = load <4 x i32>, <4 x i32>* %131
%133 = getelementptr inbounds i32, i32* %130, i64 4
%134 = bitcast i32* %133 to <4 x i32>*
%135 = load <4 x i32>, <4 x i32>* %134
%136 = icmp sgt <4 x i32> %132, %127
%137 = icmp sgt <4 x i32> %135, %128
%138 = select <4 x i1> %136, <4 x i32> %132, <4 x i32> %127
%139 = select <4 x i1> %137, <4 x i32> %135, <4 x i32> %128
%140 = add nuw i64 %114, 16
%141 = add i64 %117, 2
%142 = icmp eq i64 %141, %112
br i1 %142, label %143, label %113
143: ; preds = %113
%144 = or i64 %140, 1
br label %145
145: ; preds = %143, %101
%146 = phi <4 x i32> [ undef, %101 ], [ %138, %143 ]
%147 = phi <4 x i32> [ undef, %101 ], [ %139, %143 ]
%148 = phi i64 [ 1, %101 ], [ %144, %143 ]
%149 = phi <4 x i32> [ %105, %101 ], [ %138, %143 ]
%150 = phi <4 x i32> [ %105, %101 ], [ %139, %143 ]
%151 = icmp eq i64 %109, 0
br i1 %151, label %163, label %152
152: ; preds = %145
%153 = getelementptr inbounds i32, i32* %45, i64 %148
%154 = bitcast i32* %153 to <4 x i32>*
%155 = load <4 x i32>, <4 x i32>* %154
%156 = getelementptr inbounds i32, i32* %153, i64 4
%157 = bitcast i32* %156 to <4 x i32>*
%158 = load <4 x i32>, <4 x i32>* %157
%159 = icmp sgt <4 x i32> %155, %149
%160 = icmp sgt <4 x i32> %158, %150
%161 = select <4 x i1> %159, <4 x i32> %155, <4 x i32> %149
%162 = select <4 x i1> %160, <4 x i32> %158, <4 x i32> %150
br label %163
163: ; preds = %145, %152
%164 = phi <4 x i32> [ %146, %145 ], [ %161, %152 ]
%165 = phi <4 x i32> [ %147, %145 ], [ %162, %152 ]
%166 = icmp sgt <4 x i32> %164, %165
%167 = select <4 x i1> %166, <4 x i32> %164, <4 x i32> %165
%168 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %167)
%169 = icmp eq i64 %99, %102
br i1 %169, label %182, label %170
170: ; preds = %97, %163
%171 = phi i64 [ 1, %97 ], [ %103, %163 ]
%172 = phi i32 [ %95, %97 ], [ %168, %163 ]
br label %173
173: ; preds = %170, %173
%174 = phi i64 [ %180, %173 ], [ %171, %170 ]
%175 = phi i32 [ %179, %173 ], [ %172, %170 ]
%176 = getelementptr inbounds i32, i32* %45, i64 %174
%177 = load i32, i32* %176
%178 = icmp sgt i32 %177, %175
%179 = select i1 %178, i32 %177, i32 %175
%180 = add nuw nsw i64 %174, 1
%181 = icmp eq i64 %180, %98
br i1 %181, label %182, label %173
182: ; preds = %173, %163, %83
%183 = phi i32 [ %95, %83 ], [ %168, %163 ], [ %179, %173 ]
%184 = icmp eq i32 %183, %84
br i1 %184, label %185, label %200
185: ; preds = %182
%186 = mul nsw i32 %92, 1000000
%187 = add nsw i32 %186, %94
%188 = sext i32 %187 to i64
%189 = mul nsw i32 %88, 1000000
%190 = add nsw i32 %189, %90
%191 = sext i32 %190 to i64
%192 = sub nsw i64 %188, %191
%193 = sitofp i64 %192 to double
%194 = fdiv double %193, 1.000000e+06
%195 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.18, i64 0, i64 0))
%196 = call i32 @free(i32* %45)
%197 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.15, i64 0, i64 0), i32 %84)
%198 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0), double %194)
%199 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.19, i64 0, i64 0))
ret i32 0
200: ; preds = %182
%201 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.17, i64 0, i64 0))
%202 = call i32 @exit(i32 -1)
unreachable
}