#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__ malloc(int);
int **getArray() {
  int **a = (int **)malloc(100 * sizeof(*a));
  int i;
  for (i = 0; i < 100; i++) {
    a[i] = (int *)(((i + 1) << 1) | 1);
  }
  return a;
}


x86 assembly (clang, -O0):
<getArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x320,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jge    1160 <getArray+0x50>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
shl    $0x1,%eax
or     $0x1,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <getArray+0x1d>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getArray>:
push   %rax
mov    $0x320,%edi
call   1030 <malloc@plt>
movdqa 0xedd(%rip),%xmm0
mov    $0x2,%ecx
movdqa 0xee0(%rip),%xmm1
movdqa 0xee8(%rip),%xmm2
movdqa 0xef0(%rip),%xmm3
movdqa %xmm0,%xmm4
paddq  %xmm0,%xmm4
movdqa %xmm4,%xmm5
paddq  %xmm1,%xmm5
movdqu %xmm5,-0x10(%rax,%rcx,8)
paddq  %xmm2,%xmm4
movdqu %xmm4,(%rax,%rcx,8)
paddq  %xmm3,%xmm0
add    $0x4,%rcx
cmp    $0x66,%rcx
jne    1140 <getArray+0x30>
pop    %rcx
ret

LLVM IR (-O0):
define i32** @getArray() {
%1 = alloca i32**
%2 = alloca i32
%3 = call i64 @malloc(i32 800)
%4 = inttoptr i64 %3 to i32**
store i32** %4, i32*** %1
store i32 0, i32* %2
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
%11 = shl i32 %10, 1
%12 = or i32 %11, 1
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load i32**, i32*** %1
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32*, i32** %15, i64 %17
store i32* %14, i32** %18
br label %19
19: ; preds = %8
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %5
22: ; preds = %5
%23 = load i32**, i32*** %1
ret i32** %23
}

LLVM IR (-O2):
define i32** @getArray() {
%1 = tail call i64 @malloc(i32 800)
%2 = inttoptr i64 %1 to i32**
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %19, %3 ]
%5 = phi <2 x i64> [ <i64 0, i64 1>, %0 ], [ %20, %3 ]
%6 = shl <2 x i64> %5, <i64 1, i64 1>
%7 = add <2 x i64> %6, <i64 2, i64 2>
%8 = or <2 x i64> %7, <i64 1, i64 1>
%9 = inttoptr <2 x i64> %8 to <2 x i32*>
%10 = getelementptr inbounds i32*, i32** %2, i64 %4
%11 = bitcast i32** %10 to <2 x i32*>*
store <2 x i32*> %9, <2 x i32*>* %11
%12 = or i64 %4, 2
%13 = shl <2 x i64> %5, <i64 1, i64 1>
%14 = add <2 x i64> %13, <i64 6, i64 6>
%15 = or <2 x i64> %14, <i64 1, i64 1>
%16 = inttoptr <2 x i64> %15 to <2 x i32*>
%17 = getelementptr inbounds i32*, i32** %2, i64 %12
%18 = bitcast i32** %17 to <2 x i32*>*
store <2 x i32*> %16, <2 x i32*>* %18
%19 = add nuw nsw i64 %4, 4
%20 = add <2 x i64> %5, <i64 4, i64 4>
%21 = icmp eq i64 %19, 100
br i1 %21, label %22, label %3
22: ; preds = %3
ret i32** %2
}