#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 */
int /*<<< orphan*/ free(int *);
int *malloc(int);
void test() {
  int i = 0;
  int *a = malloc(1000000000 * sizeof(int));
#pragma omp parallel for
  for (i = 0; i < 1000000000; i++) {
    a[i] = (i * i) % 7;
  }
  free(a);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xee6b2800,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x3b9aca00,-0x4(%rbp)
jge    1179 <test+0x59>
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <test+0x24>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    $0xee6b2800,%edi
call   1040 <malloc@plt>
movdqa 0xecd(%rip),%xmm0
mov    $0x4,%ecx
movdqa 0xecf(%rip),%xmm8
movdqa 0xed6(%rip),%xmm10
movdqa 0xedd(%rip),%xmm9
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqa %xmm0,%xmm5
paddd  %xmm8,%xmm5
movdqa %xmm0,%xmm7
pmuludq %xmm0,%xmm7
pshufd $0xe8,%xmm7,%xmm6
pshufd $0xf5,%xmm0,%xmm3
pmuludq %xmm3,%xmm3
pshufd $0xe8,%xmm3,%xmm1
punpckldq %xmm1,%xmm6
pshufd $0xf5,%xmm5,%xmm1
pmuludq %xmm5,%xmm5
pshufd $0xe8,%xmm5,%xmm4
pmuludq %xmm1,%xmm1
pshufd $0xe8,%xmm1,%xmm2
punpckldq %xmm2,%xmm4
pmuludq %xmm10,%xmm7
pshufd $0xed,%xmm7,%xmm2
pmuludq %xmm10,%xmm3
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
movdqa %xmm6,%xmm7
psubd  %xmm2,%xmm7
psrld  $0x1,%xmm7
paddd  %xmm2,%xmm7
psrld  $0x2,%xmm7
movdqa %xmm7,%xmm2
pslld  $0x3,%xmm2
psubd  %xmm2,%xmm7
paddd  %xmm6,%xmm7
pmuludq %xmm10,%xmm5
pshufd $0xed,%xmm5,%xmm2
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
punpckldq %xmm1,%xmm2
movdqa %xmm4,%xmm1
psubd  %xmm2,%xmm1
psrld  $0x1,%xmm1
paddd  %xmm2,%xmm1
psrld  $0x2,%xmm1
movdqa %xmm1,%xmm2
pslld  $0x3,%xmm2
psubd  %xmm2,%xmm1
paddd  %xmm4,%xmm1
movdqu %xmm7,-0x10(%rax,%rcx,4)
movdqu %xmm1,(%rax,%rcx,4)
paddd  %xmm9,%xmm0
add    $0x8,%rcx
cmp    $0x3b9aca04,%rcx
jne    1160 <test+0x40>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @test() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @malloc(i32 -294967296)
store i32* %3, i32** %2
store i32 0, i32* %1
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1000000000
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %1
%9 = load i32, i32* %1
%10 = mul nsw i32 %8, %9
%11 = srem i32 %10, 7
%12 = load i32*, i32** %2
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
store i32 %11, i32* %15
br label %16
16: ; preds = %7
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %4
19: ; preds = %4
%20 = load i32*, i32** %2
%21 = call i32 @free(i32* %20)
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32* @malloc(i32 -294967296)
br label %2
2: ; preds = %2, %0
%3 = phi i64 [ 0, %0 ], [ %14, %2 ]
%4 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %0 ], [ %15, %2 ]
%5 = add <4 x i32> %4, <i32 4, i32 4, i32 4, i32 4>
%6 = mul nsw <4 x i32> %4, %4
%7 = mul nsw <4 x i32> %5, %5
%8 = urem <4 x i32> %6, <i32 7, i32 7, i32 7, i32 7>
%9 = urem <4 x i32> %7, <i32 7, i32 7, i32 7, i32 7>
%10 = getelementptr inbounds i32, i32* %1, i64 %3
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %11
%12 = getelementptr inbounds i32, i32* %10, i64 4
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %13
%14 = add nuw i64 %3, 8
%15 = add <4 x i32> %4, <i32 8, i32 8, i32 8, i32 8>
%16 = icmp eq i64 %14, 1000000000
br i1 %16, label %17, label %2
17: ; preds = %2
%18 = tail call i32 @free(i32* %1)
ret void
}