#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;
};

/* 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_set_num_threads(int);
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;
  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 using  ");
  printf("\n\t\t OpenMP Parallel for directive and Critical Section  ");
  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]);
  if (Noofelements <= 0) {
    printf("\n\t\t The array elements cannot be stored\n");
    exit(1);
  }
  printf("\n\t\t Threads                     : %d ", Noofthreads);
  printf("\n\t\t Number of elements in Array : %d \n ", Noofelements);
  array = (int *)malloc(sizeof(int) * Noofelements);
  srand(65536);
  for (i = 0; i < Noofelements; i++)
    array[i] = rand();
  if (Noofelements == 1) {
    printf("\n\t\t The Largest Number In The Array is %d", array[0]);
    exit(1);
  }
  cur_max = 0;
  gettimeofday(&TimeValue_Start, &TimeZone_Start);
  omp_set_num_threads(Noofthreads);
#pragma omp parallel for
  for (i = 0; i < Noofelements; i = i + 1) {
    if (array[i] > cur_max)
#pragma omp critical
      if (array[i] > cur_max)
        cur_max = array[i];
  }
  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\t\t The Max Value Is Same From Serial And Parallel OpenMP "
           "Directive\n");
  else {
    printf("\n\t\t The Max Value Is Not Same In Serial And Parallel OpenMP "
           "Directive\n");
    exit(-1);
  }
  printf("\n");
  free(array);
  printf("\n\t\t The Largest Number In The Given 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    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
je     122a <main+0x9a>
lea    0xf23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
je     1284 <main+0xf4>
cmpl   $0x2,-0x2c(%rbp)
je     1284 <main+0xf4>
cmpl   $0x4,-0x2c(%rbp)
je     1284 <main+0xf4>
cmpl   $0x8,-0x2c(%rbp)
je     1284 <main+0xf4>
cmpl   $0x10,-0x2c(%rbp)
je     1284 <main+0xf4>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jg     12b6 <main+0x126>
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x2c(%rbp),%esi
lea    0xf2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xf40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x10000,%edi
call   1060 <srand@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    132a <main+0x19a>
mov    $0x0,%al
call   10b0 <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    12fc <main+0x16c>
cmpl   $0x1,-0x20(%rbp)
jne    1352 <main+0x1c2>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
movl   $0x0,-0x24(%rbp)
lea    -0x38(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <gettimeofday@plt>
mov    -0x2c(%rbp),%edi
call   1080 <omp_set_num_threads@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    13cf <main+0x23f>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x24(%rbp),%eax
jle    13bc <main+0x22c>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x24(%rbp),%eax
jle    13b7 <main+0x227>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
jmp    13bc <main+0x22c>
jmp    13c1 <main+0x231>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1375 <main+0x1e5>
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1050 <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  0xbef(%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    146b <main+0x2db>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jle    1458 <main+0x2c8>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x28(%rbp)
jmp    145d <main+0x2cd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    142a <main+0x29a>
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    148a <main+0x2fa>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14a2 <main+0x312>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x68(%rbp),%xmm0
lea    0xe4a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xbfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0xe3f(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe7d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x104b(%rip),%rdi
call   1050 <puts@plt>
cmp    $0x3,%r14d
jne    1696 <main+0x4e6>
mov    0x8(%rbx),%rdi
call   10b0 <atoi@plt>
cmp    $0x10,%eax
ja     16f3 <main+0x543>
mov    %eax,%r12d
mov    $0x10116,%eax
bt     %r12d,%eax
jae    16f3 <main+0x543>
mov    0x10(%rbx),%rdi
call   10b0 <atoi@plt>
test   %eax,%eax
jle    16ad <main+0x4fd>
mov    %eax,%r14d
lea    0xe9b(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x0(,%r14,4),%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    $0x10000,%edi
call   1080 <srand@plt>
mov    %r14d,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   10d0 <rand@plt>
mov    %eax,(%rbx,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    12a0 <main+0xf0>
cmp    $0x1,%r14d
je     16c3 <main+0x513>
lea    0x10(%rsp),%rdi
lea    0x28(%rsp),%rsi
call   1070 <gettimeofday@plt>
mov    %r12d,%edi
call   10a0 <omp_set_num_threads@plt>
test   %r14d,%r14d
jle    12e8 <main+0x138>
cmp    $0x8,%r14d
jae    12ef <main+0x13f>
xor    %eax,%eax
xor    %ebp,%ebp
jmp    1420 <main+0x270>
xor    %ebp,%ebp
jmp    1431 <main+0x281>
mov    %r15d,%eax
and    $0xfffffff8,%eax
lea    -0x8(%rax),%rdx
mov    %rdx,%rcx
shr    $0x3,%rcx
add    $0x1,%rcx
test   %rdx,%rdx
je     1667 <main+0x4b7>
mov    %rcx,%rsi
and    $0xfffffffffffffffe,%rsi
pxor   %xmm0,%xmm0
xor    %edx,%edx
pxor   %xmm1,%xmm1
xchg   %ax,%ax
movdqu (%rbx,%rdx,4),%xmm2
movdqu 0x10(%rbx,%rdx,4),%xmm3
movdqu 0x20(%rbx,%rdx,4),%xmm4
movdqu 0x30(%rbx,%rdx,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,%rdx
add    $0xfffffffffffffffe,%rsi
jne    1320 <main+0x170>
test   $0x1,%cl
je     13d1 <main+0x221>
movdqu (%rbx,%rdx,4),%xmm2
movdqu 0x10(%rbx,%rdx,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,%ebp
cmp    %r15,%rax
je     1431 <main+0x281>
mov    (%rbx,%rax,4),%ecx
cmp    %ebp,%ecx
cmovg  %ecx,%ebp
add    $0x1,%rax
cmp    %rax,%r15
jne    1420 <main+0x270>
lea    0x8(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1070 <gettimeofday@plt>
mov    (%rbx),%edx
cmp    $0x2,%r14d
jl     15c1 <main+0x411>
lea    -0x1(%r15),%rcx
mov    $0x1,%eax
cmp    $0x8,%rcx
jb     15b0 <main+0x400>
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     167f <main+0x4cf>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0x1,%esi
movdqa %xmm0,%xmm1
nopw   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    14a0 <main+0x2f0>
test   $0x1,%dl
je     1551 <main+0x3a1>
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     15c1 <main+0x411>
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,%r15
jne    15b0 <main+0x400>
cmp    %ebp,%edx
jne    16dd <main+0x52d>
movslq 0x10(%rsp),%rax
movslq 0x14(%rsp),%rcx
movslq 0x8(%rsp),%rdx
movslq 0xc(%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  0x9fc(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0xc04(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xb40(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xb61(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xc06(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
pxor   %xmm0,%xmm0
xor    %edx,%edx
pxor   %xmm1,%xmm1
test   $0x1,%cl
jne    1396 <main+0x1e6>
jmp    13d1 <main+0x221>
mov    $0x1,%esi
movdqa %xmm0,%xmm1
test   $0x1,%dl
jne    1516 <main+0x366>
jmp    1551 <main+0x3a1>
lea    0xa42(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc70(%rip),%rdi
jmp    16e4 <main+0x534>
lea    0xbf3(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    (%rbx),%esi
lea    0xa79(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0xaeb(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
lea    0xbd5(%rip),%rdi
jmp    16e4 <main+0x534>

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

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 = [60 x i8] c"\0A\09\09 Objective : Finding Maximum element of an Array using \00"
@.str.3 = [57 x i8] c"\0A\09\09 OpenMP Parallel for directive and Critical Section \00"
@.str.5 = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.9 = [38 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 = [42 x i8] c"\0A\09\09 The Largest Number In The Array is %d\00"
@.str.15 = [49 x i8] c"\0A\09\09 The Largest Number In The Given Array Is %d\0A\00"
@.str.16 = [47 x i8] c"\0A\09\09 Time in Seconds (T) : %lf Seconds \0A\00"
@str.17 = [70 x i8] c"\0A\09\09 The Max Value Is Not Same In Serial And Parallel OpenMP Directive\00"
@str.18 = [68 x i8] c"\0A\09\09 The Max Value Is Same From Serial And 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 = [46 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 = bitcast %struct.timeval* %3 to i8*
%8 = bitcast %struct.timezone* %4 to i8*
%9 = bitcast %struct.timeval* %5 to i8*
%10 = bitcast %struct.timezone* %6 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%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 ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.19, i64 0, i64 0))
%17 = icmp eq i32 %0, 3
br i1 %17, label %22, label %18
18: ; preds = %2
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.22, i64 0, i64 0))
%21 = tail call i32 @exit(i32 -1)
unreachable
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
switch i32 %25, label %26 [
i32 16, label %29
i32 8, label %29
i32 4, label %29
i32 2, label %29
i32 1, label %29
]
26: ; preds = %22
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str.21, i64 0, i64 0))
%28 = tail call i32 @exit(i32 -1)
unreachable
29: ; preds = %22, %22, %22, %22, %22
%30 = getelementptr inbounds i8*, i8** %1, i64 2
%31 = load i8*, i8** %30
%32 = tail call i32 @atoi(i8* %31)
%33 = icmp slt i32 %32, 1
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.20, i64 0, i64 0))
%36 = tail call i32 @exit(i32 1)
unreachable
37: ; preds = %29
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %25)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), i32 %32)
%40 = shl i32 %32, 2
%41 = tail call i64 @malloc(i32 %40)
%42 = inttoptr i64 %41 to i32*
%43 = tail call i32 @srand(i32 65536)
%44 = zext i32 %32 to i64
br label %45
45: ; preds = %37, %45
%46 = phi i64 [ 0, %37 ], [ %49, %45 ]
%47 = tail call i32 (...) @rand()
%48 = getelementptr inbounds i32, i32* %42, i64 %46
store i32 %47, i32* %48
%49 = add nuw nsw i64 %46, 1
%50 = icmp eq i64 %49, %44
br i1 %50, label %51, label %45
51: ; preds = %45
%52 = icmp eq i32 %32, 1
br i1 %52, label %53, label %57
53: ; preds = %51
%54 = load i32, i32* %42
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0), i32 %54)
%56 = tail call i32 @exit(i32 1)
unreachable
57: ; preds = %51
%58 = call i32 @gettimeofday(%struct.timeval* %3, %struct.timezone* %4)
%59 = tail call i32 @omp_set_num_threads(i32 %25)
%60 = icmp sgt i32 %32, 0
br i1 %60, label %61, label %139
61: ; preds = %57
%62 = zext i32 %32 to i64
%63 = icmp ult i32 %32, 8
br i1 %63, label %127, label %64
64: ; preds = %61
%65 = and i64 %44, 4294967288
%66 = add nsw i64 %65, -8
%67 = lshr exact i64 %66, 3
%68 = add nuw nsw i64 %67, 1
%69 = and i64 %68, 1
%70 = icmp eq i64 %66, 0
br i1 %70, label %102, label %71
71: ; preds = %64
%72 = and i64 %68, 4611686018427387902
br label %73
73: ; preds = %73, %71
%74 = phi i64 [ 0, %71 ], [ %99, %73 ]
%75 = phi <4 x i32> [ zeroinitializer, %71 ], [ %97, %73 ]
%76 = phi <4 x i32> [ zeroinitializer, %71 ], [ %98, %73 ]
%77 = phi i64 [ 0, %71 ], [ %100, %73 ]
%78 = getelementptr inbounds i32, i32* %42, i64 %74
%79 = bitcast i32* %78 to <4 x i32>*
%80 = load <4 x i32>, <4 x i32>* %79
%81 = getelementptr inbounds i32, i32* %78, i64 4
%82 = bitcast i32* %81 to <4 x i32>*
%83 = load <4 x i32>, <4 x i32>* %82
%84 = icmp sgt <4 x i32> %80, %75
%85 = icmp sgt <4 x i32> %83, %76
%86 = select <4 x i1> %84, <4 x i32> %80, <4 x i32> %75
%87 = select <4 x i1> %85, <4 x i32> %83, <4 x i32> %76
%88 = or i64 %74, 8
%89 = getelementptr inbounds i32, i32* %42, i64 %88
%90 = bitcast i32* %89 to <4 x i32>*
%91 = load <4 x i32>, <4 x i32>* %90
%92 = getelementptr inbounds i32, i32* %89, i64 4
%93 = bitcast i32* %92 to <4 x i32>*
%94 = load <4 x i32>, <4 x i32>* %93
%95 = icmp sgt <4 x i32> %91, %86
%96 = icmp sgt <4 x i32> %94, %87
%97 = select <4 x i1> %95, <4 x i32> %91, <4 x i32> %86
%98 = select <4 x i1> %96, <4 x i32> %94, <4 x i32> %87
%99 = add nuw i64 %74, 16
%100 = add i64 %77, 2
%101 = icmp eq i64 %100, %72
br i1 %101, label %102, label %73
102: ; preds = %73, %64
%103 = phi <4 x i32> [ undef, %64 ], [ %97, %73 ]
%104 = phi <4 x i32> [ undef, %64 ], [ %98, %73 ]
%105 = phi i64 [ 0, %64 ], [ %99, %73 ]
%106 = phi <4 x i32> [ zeroinitializer, %64 ], [ %97, %73 ]
%107 = phi <4 x i32> [ zeroinitializer, %64 ], [ %98, %73 ]
%108 = icmp eq i64 %69, 0
br i1 %108, label %120, label %109
109: ; preds = %102
%110 = getelementptr inbounds i32, i32* %42, i64 %105
%111 = bitcast i32* %110 to <4 x i32>*
%112 = load <4 x i32>, <4 x i32>* %111
%113 = getelementptr inbounds i32, i32* %110, i64 4
%114 = bitcast i32* %113 to <4 x i32>*
%115 = load <4 x i32>, <4 x i32>* %114
%116 = icmp sgt <4 x i32> %112, %106
%117 = icmp sgt <4 x i32> %115, %107
%118 = select <4 x i1> %116, <4 x i32> %112, <4 x i32> %106
%119 = select <4 x i1> %117, <4 x i32> %115, <4 x i32> %107
br label %120
120: ; preds = %102, %109
%121 = phi <4 x i32> [ %103, %102 ], [ %118, %109 ]
%122 = phi <4 x i32> [ %104, %102 ], [ %119, %109 ]
%123 = icmp sgt <4 x i32> %121, %122
%124 = select <4 x i1> %123, <4 x i32> %121, <4 x i32> %122
%125 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %124)
%126 = icmp eq i64 %65, %44
br i1 %126, label %139, label %127
127: ; preds = %61, %120
%128 = phi i64 [ 0, %61 ], [ %65, %120 ]
%129 = phi i32 [ 0, %61 ], [ %125, %120 ]
br label %130
130: ; preds = %127, %130
%131 = phi i64 [ %137, %130 ], [ %128, %127 ]
%132 = phi i32 [ %136, %130 ], [ %129, %127 ]
%133 = getelementptr inbounds i32, i32* %42, i64 %131
%134 = load i32, i32* %133
%135 = icmp sgt i32 %134, %132
%136 = select i1 %135, i32 %134, i32 %132
%137 = add nuw nsw i64 %131, 1
%138 = icmp eq i64 %137, %62
br i1 %138, label %139, label %130
139: ; preds = %130, %120, %57
%140 = phi i32 [ 0, %57 ], [ %125, %120 ], [ %136, %130 ]
%141 = call i32 @gettimeofday(%struct.timeval* %5, %struct.timezone* %6)
%142 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%143 = load i32, i32* %142
%144 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%145 = load i32, i32* %144
%146 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%147 = load i32, i32* %146
%148 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%149 = load i32, i32* %148
%150 = load i32, i32* %42
%151 = icmp sgt i32 %32, 1
br i1 %151, label %152, label %237
152: ; preds = %139
%153 = zext i32 %32 to i64
%154 = add nsw i64 %44, -1
%155 = icmp ult i64 %154, 8
br i1 %155, label %225, label %156
156: ; preds = %152
%157 = and i64 %154, -8
%158 = or i64 %157, 1
%159 = insertelement <4 x i32> poison, i32 %150, i64 0
%160 = shufflevector <4 x i32> %159, <4 x i32> poison, <4 x i32> zeroinitializer
%161 = add nsw i64 %157, -8
%162 = lshr exact i64 %161, 3
%163 = add nuw nsw i64 %162, 1
%164 = and i64 %163, 1
%165 = icmp eq i64 %161, 0
br i1 %165, label %200, label %166
166: ; preds = %156
%167 = and i64 %163, 4611686018427387902
br label %168
168: ; preds = %168, %166
%169 = phi i64 [ 0, %166 ], [ %195, %168 ]
%170 = phi <4 x i32> [ %160, %166 ], [ %193, %168 ]
%171 = phi <4 x i32> [ %160, %166 ], [ %194, %168 ]
%172 = phi i64 [ 0, %166 ], [ %196, %168 ]
%173 = or i64 %169, 1
%174 = getelementptr inbounds i32, i32* %42, i64 %173
%175 = bitcast i32* %174 to <4 x i32>*
%176 = load <4 x i32>, <4 x i32>* %175
%177 = getelementptr inbounds i32, i32* %174, i64 4
%178 = bitcast i32* %177 to <4 x i32>*
%179 = load <4 x i32>, <4 x i32>* %178
%180 = icmp sgt <4 x i32> %176, %170
%181 = icmp sgt <4 x i32> %179, %171
%182 = select <4 x i1> %180, <4 x i32> %176, <4 x i32> %170
%183 = select <4 x i1> %181, <4 x i32> %179, <4 x i32> %171
%184 = or i64 %169, 9
%185 = getelementptr inbounds i32, i32* %42, i64 %184
%186 = bitcast i32* %185 to <4 x i32>*
%187 = load <4 x i32>, <4 x i32>* %186
%188 = getelementptr inbounds i32, i32* %185, i64 4
%189 = bitcast i32* %188 to <4 x i32>*
%190 = load <4 x i32>, <4 x i32>* %189
%191 = icmp sgt <4 x i32> %187, %182
%192 = icmp sgt <4 x i32> %190, %183
%193 = select <4 x i1> %191, <4 x i32> %187, <4 x i32> %182
%194 = select <4 x i1> %192, <4 x i32> %190, <4 x i32> %183
%195 = add nuw i64 %169, 16
%196 = add i64 %172, 2
%197 = icmp eq i64 %196, %167
br i1 %197, label %198, label %168
198: ; preds = %168
%199 = or i64 %195, 1
br label %200
200: ; preds = %198, %156
%201 = phi <4 x i32> [ undef, %156 ], [ %193, %198 ]
%202 = phi <4 x i32> [ undef, %156 ], [ %194, %198 ]
%203 = phi i64 [ 1, %156 ], [ %199, %198 ]
%204 = phi <4 x i32> [ %160, %156 ], [ %193, %198 ]
%205 = phi <4 x i32> [ %160, %156 ], [ %194, %198 ]
%206 = icmp eq i64 %164, 0
br i1 %206, label %218, label %207
207: ; preds = %200
%208 = getelementptr inbounds i32, i32* %42, i64 %203
%209 = bitcast i32* %208 to <4 x i32>*
%210 = load <4 x i32>, <4 x i32>* %209
%211 = getelementptr inbounds i32, i32* %208, i64 4
%212 = bitcast i32* %211 to <4 x i32>*
%213 = load <4 x i32>, <4 x i32>* %212
%214 = icmp sgt <4 x i32> %210, %204
%215 = icmp sgt <4 x i32> %213, %205
%216 = select <4 x i1> %214, <4 x i32> %210, <4 x i32> %204
%217 = select <4 x i1> %215, <4 x i32> %213, <4 x i32> %205
br label %218
218: ; preds = %200, %207
%219 = phi <4 x i32> [ %201, %200 ], [ %216, %207 ]
%220 = phi <4 x i32> [ %202, %200 ], [ %217, %207 ]
%221 = icmp sgt <4 x i32> %219, %220
%222 = select <4 x i1> %221, <4 x i32> %219, <4 x i32> %220
%223 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %222)
%224 = icmp eq i64 %154, %157
br i1 %224, label %237, label %225
225: ; preds = %152, %218
%226 = phi i64 [ 1, %152 ], [ %158, %218 ]
%227 = phi i32 [ %150, %152 ], [ %223, %218 ]
br label %228
228: ; preds = %225, %228
%229 = phi i64 [ %235, %228 ], [ %226, %225 ]
%230 = phi i32 [ %234, %228 ], [ %227, %225 ]
%231 = getelementptr inbounds i32, i32* %42, i64 %229
%232 = load i32, i32* %231
%233 = icmp sgt i32 %232, %230
%234 = select i1 %233, i32 %232, i32 %230
%235 = add nuw nsw i64 %229, 1
%236 = icmp eq i64 %235, %153
br i1 %236, label %237, label %228
237: ; preds = %228, %218, %139
%238 = phi i32 [ %150, %139 ], [ %223, %218 ], [ %234, %228 ]
%239 = icmp eq i32 %238, %140
br i1 %239, label %240, label %256
240: ; preds = %237
%241 = mul nsw i32 %147, 1000000
%242 = add nsw i32 %241, %149
%243 = sext i32 %242 to i64
%244 = mul nsw i32 %143, 1000000
%245 = add nsw i32 %244, %145
%246 = sext i32 %245 to i64
%247 = sub nsw i64 %243, %246
%248 = sitofp i64 %247 to double
%249 = fdiv double %248, 1.000000e+06
%250 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str.18, i64 0, i64 0))
%251 = tail call i32 @putchar(i32 10)
%252 = tail call i32 @free(i32* %42)
%253 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.15, i64 0, i64 0), i32 %140)
%254 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0), double %249)
%255 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.19, i64 0, i64 0))
ret i32 0
256: ; preds = %237
%257 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.17, i64 0, i64 0))
%258 = tail call i32 @exit(i32 -1)
unreachable
}