#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 */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int *createArray(int max) {
  int i;
  int *array = malloc(max * sizeof(int *));
  srand(time(NULL));
  for (i = 0; i < max; i++) {
    array[i] = rand() % 50;
  }
  printf("The value of the label array(adress) is: %p \n", &array);
  printf("The first value of the array is: %d\n", array[0]);
  printf("The size of an integer is: %lu\n", sizeof(int));
  printf("The size of the array is: %zu\n", sizeof(array));
  int *a;
  a = array;
  for (i = 0; i < max; i++) {
    printf("%d ", array[i]);
  }
  printf("\n");
  for (i = 0; i < max; i++) {
    a[i] = a[i] * 2;
  }
  for (i = 0; i < max; i++) {
    printf("%d ", array[i]);
  }
  printf("\n");
  return array;
}


x86 assembly (clang, -O0):
<createArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b9 <createArray+0x69>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1185 <createArray+0x35>
lea    0xe40(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1247 <createArray+0xf7>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1214 <createArray+0xc4>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    128f <createArray+0x13f>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
shl    $0x1,%edx
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    125c <createArray+0x10c>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12c9 <createArray+0x179>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1296 <createArray+0x146>
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createArray>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%r14d
lea    0x0(,%r14,8),%edi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    %rax,0x8(%rsp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    %r14d,%r15d
test   %r14d,%r14d
jle    11cf <createArray+0x6f>
xor    %ebx,%ebx
nopl   (%rax)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x32,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11a0 <createArray+0x40>
lea    0xe2a(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%esi
lea    0xe3e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe55(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe62(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    128b <createArray+0x12b>
mov    0x8(%rsp),%r13
mov    0x0(%r13),%esi
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%r14d
je     126b <createArray+0x10b>
mov    $0x1,%ebx
lea    0xe47(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
mov    (%rax,%rbx,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1250 <createArray+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    138b <createArray+0x22b>
cmp    $0x8,%r14d
jae    129a <createArray+0x13a>
xor    %eax,%eax
jmp    1350 <createArray+0x1f0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    138b <createArray+0x22b>
mov    %r15d,%eax
and    $0xfffffff8,%eax
lea    -0x8(%rax),%rcx
mov    %rcx,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     13a8 <createArray+0x248>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqu 0x0(%r13,%rcx,4),%xmm0
movdqu 0x10(%r13,%rcx,4),%xmm1
movdqu 0x20(%r13,%rcx,4),%xmm2
movdqu 0x30(%r13,%rcx,4),%xmm3
paddd  %xmm0,%xmm0
paddd  %xmm1,%xmm1
movdqu %xmm0,0x0(%r13,%rcx,4)
movdqu %xmm1,0x10(%r13,%rcx,4)
paddd  %xmm2,%xmm2
paddd  %xmm3,%xmm3
movdqu %xmm2,0x20(%r13,%rcx,4)
movdqu %xmm3,0x30(%r13,%rcx,4)
add    $0x10,%rcx
add    $0xfffffffffffffffe,%rsi
jne    12d0 <createArray+0x170>
test   $0x1,%dl
je     134b <createArray+0x1eb>
movdqu 0x0(%r13,%rcx,4),%xmm0
movdqu 0x10(%r13,%rcx,4),%xmm1
paddd  %xmm0,%xmm0
paddd  %xmm1,%xmm1
movdqu %xmm0,0x0(%r13,%rcx,4)
movdqu %xmm1,0x10(%r13,%rcx,4)
cmp    %r15,%rax
je     135e <createArray+0x1fe>
shll   0x0(%r13,%rax,4)
add    $0x1,%rax
cmp    %rax,%r15
jne    1350 <createArray+0x1f0>
test   %r14d,%r14d
jle    138b <createArray+0x22b>
lea    0xd28(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x8(%rsp),%rax
mov    (%rax,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1370 <createArray+0x210>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
xor    %ecx,%ecx
test   $0x1,%dl
jne    1327 <createArray+0x1c7>
jmp    134b <createArray+0x1eb>

LLVM IR (-O0):
@.str = [46 x i8] c"The value of the label array(adress) is: %p \0A\00"
@.str.1 = [37 x i8] c"The first value of the array is: %d\0A\00"
@.str.2 = [32 x i8] c"The size of an integer is: %lu\0A\00"
@.str.3 = [31 x i8] c"The size of the array is: %zu\0A\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [2 x i8] c"\0A\00"
define i32* @createArray(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 8
%9 = trunc i64 %8 to i32
%10 = call i32* @malloc(i32 %9)
store i32* %10, i32** %4
%11 = call i32 @time(i32* null)
%12 = call i32 @srand(i32 %11)
store i32 0, i32* %3
br label %13
13: ; preds = %24, %1
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = call i32 (...) @rand()
%19 = srem i32 %18, 50
%20 = load i32*, i32** %4
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
br label %24
24: ; preds = %17
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %13
27: ; preds = %13
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32** %4)
%29 = load i32*, i32** %4
%30 = getelementptr inbounds i32, i32* %29, i64 0
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i64 4)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i64 8)
%35 = load i32*, i32** %4
store i32* %35, i32** %5
store i32 0, i32* %3
br label %36
36: ; preds = %47, %27
%37 = load i32, i32* %3
%38 = load i32, i32* %2
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = load i32*, i32** %4
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %40
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %36
50: ; preds = %36
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %52
52: ; preds = %67, %50
%53 = load i32, i32* %3
%54 = load i32, i32* %2
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %70
56: ; preds = %52
%57 = load i32*, i32** %5
%58 = load i32, i32* %3
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i32, i32* %57, i64 %59
%61 = load i32, i32* %60
%62 = mul nsw i32 %61, 2
%63 = load i32*, i32** %5
%64 = load i32, i32* %3
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
store i32 %62, i32* %66
br label %67
67: ; preds = %56
%68 = load i32, i32* %3
%69 = add nsw i32 %68, 1
store i32 %69, i32* %3
br label %52
70: ; preds = %52
store i32 0, i32* %3
br label %71
71: ; preds = %82, %70
%72 = load i32, i32* %3
%73 = load i32, i32* %2
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %85
75: ; preds = %71
%76 = load i32*, i32** %4
%77 = load i32, i32* %3
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %76, i64 %78
%80 = load i32, i32* %79
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %80)
br label %82
82: ; preds = %75
%83 = load i32, i32* %3
%84 = add nsw i32 %83, 1
store i32 %84, i32* %3
br label %71
85: ; preds = %71
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%87 = load i32*, i32** %4
ret i32* %87
}

LLVM IR (-O2):
@.str = [46 x i8] c"The value of the label array(adress) is: %p \0A\00"
@.str.1 = [37 x i8] c"The first value of the array is: %d\0A\00"
@.str.2 = [32 x i8] c"The size of an integer is: %lu\0A\00"
@.str.3 = [31 x i8] c"The size of the array is: %zu\0A\00"
@.str.4 = [4 x i8] c"%d \00"
define i32* @createArray(i32 %0) {
%2 = alloca i32*
%3 = bitcast i32** %2 to i8*
%4 = shl i32 %0, 3
%5 = tail call i32* @malloc(i32 %4)
store i32* %5, i32** %2
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @srand(i32 %6)
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %16, %11 ]
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 50
%15 = getelementptr inbounds i32, i32* %5, i64 %12
store i32 %14, i32* %15
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %1
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32** %2)
%20 = load i32*, i32** %2
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i64 4)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i64 8)
%25 = load i32*, i32** %2
br i1 %8, label %28, label %26
26: ; preds = %18
%27 = call i32 @putchar(i32 10)
br label %118
28: ; preds = %18
%29 = zext i32 %0 to i64
%30 = load i32, i32* %25
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = icmp eq i32 %0, 1
br i1 %32, label %41, label %33
33: ; preds = %28, %33
%34 = phi i64 [ %39, %33 ], [ 1, %28 ]
%35 = load i32*, i32** %2
%36 = getelementptr inbounds i32, i32* %35, i64 %34
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %37)
%39 = add nuw nsw i64 %34, 1
%40 = icmp eq i64 %39, %29
br i1 %40, label %41, label %33
41: ; preds = %33, %28
%42 = call i32 @putchar(i32 10)
br i1 %8, label %43, label %118
43: ; preds = %41
%44 = zext i32 %0 to i64
%45 = icmp ult i32 %0, 8
br i1 %45, label %98, label %46
46: ; preds = %43
%47 = and i64 %29, 4294967288
%48 = add nsw i64 %47, -8
%49 = lshr exact i64 %48, 3
%50 = add nuw nsw i64 %49, 1
%51 = and i64 %50, 1
%52 = icmp eq i64 %48, 0
br i1 %52, label %82, label %53
53: ; preds = %46
%54 = and i64 %50, 4611686018427387902
br label %55
55: ; preds = %55, %53
%56 = phi i64 [ 0, %53 ], [ %79, %55 ]
%57 = phi i64 [ 0, %53 ], [ %80, %55 ]
%58 = getelementptr inbounds i32, i32* %25, i64 %56
%59 = bitcast i32* %58 to <4 x i32>*
%60 = load <4 x i32>, <4 x i32>* %59
%61 = getelementptr inbounds i32, i32* %58, i64 4
%62 = bitcast i32* %61 to <4 x i32>*
%63 = load <4 x i32>, <4 x i32>* %62
%64 = shl nsw <4 x i32> %60, <i32 1, i32 1, i32 1, i32 1>
%65 = shl nsw <4 x i32> %63, <i32 1, i32 1, i32 1, i32 1>
%66 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> %64, <4 x i32>* %66
%67 = bitcast i32* %61 to <4 x i32>*
store <4 x i32> %65, <4 x i32>* %67
%68 = or i64 %56, 8
%69 = getelementptr inbounds i32, i32* %25, i64 %68
%70 = bitcast i32* %69 to <4 x i32>*
%71 = load <4 x i32>, <4 x i32>* %70
%72 = getelementptr inbounds i32, i32* %69, i64 4
%73 = bitcast i32* %72 to <4 x i32>*
%74 = load <4 x i32>, <4 x i32>* %73
%75 = shl nsw <4 x i32> %71, <i32 1, i32 1, i32 1, i32 1>
%76 = shl nsw <4 x i32> %74, <i32 1, i32 1, i32 1, i32 1>
%77 = bitcast i32* %69 to <4 x i32>*
store <4 x i32> %75, <4 x i32>* %77
%78 = bitcast i32* %72 to <4 x i32>*
store <4 x i32> %76, <4 x i32>* %78
%79 = add nuw i64 %56, 16
%80 = add i64 %57, 2
%81 = icmp eq i64 %80, %54
br i1 %81, label %82, label %55
82: ; preds = %55, %46
%83 = phi i64 [ 0, %46 ], [ %79, %55 ]
%84 = icmp eq i64 %51, 0
br i1 %84, label %96, label %85
85: ; preds = %82
%86 = getelementptr inbounds i32, i32* %25, i64 %83
%87 = bitcast i32* %86 to <4 x i32>*
%88 = load <4 x i32>, <4 x i32>* %87
%89 = getelementptr inbounds i32, i32* %86, i64 4
%90 = bitcast i32* %89 to <4 x i32>*
%91 = load <4 x i32>, <4 x i32>* %90
%92 = shl nsw <4 x i32> %88, <i32 1, i32 1, i32 1, i32 1>
%93 = shl nsw <4 x i32> %91, <i32 1, i32 1, i32 1, i32 1>
%94 = bitcast i32* %86 to <4 x i32>*
store <4 x i32> %92, <4 x i32>* %94
%95 = bitcast i32* %89 to <4 x i32>*
store <4 x i32> %93, <4 x i32>* %95
br label %96
96: ; preds = %82, %85
%97 = icmp eq i64 %47, %29
br i1 %97, label %100, label %98
98: ; preds = %43, %96
%99 = phi i64 [ 0, %43 ], [ %47, %96 ]
br label %103
100: ; preds = %103, %96
br i1 %8, label %101, label %118
101: ; preds = %100
%102 = zext i32 %0 to i64
br label %110
103: ; preds = %98, %103
%104 = phi i64 [ %108, %103 ], [ %99, %98 ]
%105 = getelementptr inbounds i32, i32* %25, i64 %104
%106 = load i32, i32* %105
%107 = shl nsw i32 %106, 1
store i32 %107, i32* %105
%108 = add nuw nsw i64 %104, 1
%109 = icmp eq i64 %108, %44
br i1 %109, label %100, label %103
110: ; preds = %101, %110
%111 = phi i64 [ 0, %101 ], [ %116, %110 ]
%112 = load i32*, i32** %2
%113 = getelementptr inbounds i32, i32* %112, i64 %111
%114 = load i32, i32* %113
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %114)
%116 = add nuw nsw i64 %111, 1
%117 = icmp eq i64 %116, %102
br i1 %117, label %118, label %110
118: ; preds = %110, %41, %26, %100
%119 = call i32 @putchar(i32 10)
%120 = load i32*, i32** %2
ret i32* %120
}