#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*/ arr;

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(int **, int **, int);
int (*func_pointer_012_func_001())[4] {
  int(*p)[4];
  int arr[4][4] = {
      {1, 2, 3, 4}, {11, 22, 33, 44}, {33, 44, 55, 66}, {55, 66, 77, 88}};
  int i, j;
  p = (int(*)[])malloc(sizeof arr);
  if (p != NULL) {
    memcpy(p, arr, sizeof(arr));
    for (i = 0; i < 4; i++) {
      for (j = 0; j < 4; j++) {
        *(p[i] + j) += *(p[i] + j);
      }
    }
  }
  return p;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x40,%edx
call   1030 <memcpy@plt>
mov    $0x40,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11df <func_pointer_012_func_001+0xbf>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x4,-0x54(%rbp)
jge    11da <func_pointer_012_func_001+0xba>
movl   $0x0,-0x58(%rbp)
cmpl   $0x4,-0x58(%rbp)
jge    11c7 <func_pointer_012_func_001+0xa7>
mov    -0x8(%rbp),%rax
movslq -0x54(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x54(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x58(%rbp),%rcx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1180 <func_pointer_012_func_001+0x60>
jmp    11cc <func_pointer_012_func_001+0xac>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    116f <func_pointer_012_func_001+0x4f>
jmp    11df <func_pointer_012_func_001+0xbf>
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
sub    $0x40,%rsp
movaps 0xf04(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movdqa 0xeaf(%rip),%xmm0
movdqa %xmm0,(%rsp)
mov    $0x40,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11ae <func_pointer_012_func_001+0x8e>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x40,%edx
call   1030 <memcpy@plt>
movdqu (%rbx),%xmm0
movdqu 0x10(%rbx),%xmm1
movdqu 0x20(%rbx),%xmm2
movdqu 0x30(%rbx),%xmm3
paddd  %xmm0,%xmm0
movdqu %xmm0,(%rbx)
paddd  %xmm1,%xmm1
movdqu %xmm1,0x10(%rbx)
paddd  %xmm2,%xmm2
movdqu %xmm2,0x20(%rbx)
paddd  %xmm3,%xmm3
movdqu %xmm3,0x30(%rbx)
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.func_pointer_012_func_001.arr = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 11, i32 22, i32 33, i32 44], [4 x i32] [i32 33, i32 44, i32 55, i32 66], [4 x i32] [i32 55, i32 66, i32 77, i32 88]]
define [4 x i32]* @func_pointer_012_func_001() {
%1 = alloca [4 x i32]*
%2 = alloca [4 x [4 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [4 x [4 x i32]]* %2 to i8*
%6 = call i64 @malloc(i32 64)
%7 = inttoptr i64 %6 to [0 x i32]*
%8 = bitcast [0 x i32]* %7 to [4 x i32]*
store [4 x i32]* %8, [4 x i32]** %1
%9 = load [4 x i32]*, [4 x i32]** %1
%10 = icmp ne [4 x i32]* %9, null
br i1 %10, label %11, label %52
11: ; preds = %0
%12 = load [4 x i32]*, [4 x i32]** %1
%13 = bitcast [4 x i32]* %12 to i32**
%14 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %2, i64 0, i64 0
%15 = bitcast [4 x i32]* %14 to i32**
%16 = call i32 @memcpy(i32** %13, i32** %15, i32 64)
store i32 0, i32* %3
br label %17
17: ; preds = %48, %11
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 4
br i1 %19, label %20, label %51
20: ; preds = %17
store i32 0, i32* %4
br label %21
21: ; preds = %44, %20
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 4
br i1 %23, label %24, label %47
24: ; preds = %21
%25 = load [4 x i32]*, [4 x i32]** %1
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %25, i64 %27
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %28, i64 0, i64 0
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = load [4 x i32]*, [4 x i32]** %1
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x i32], [4 x i32]* %34, i64 %36
%38 = getelementptr inbounds [4 x i32], [4 x i32]* %37, i64 0, i64 0
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
%42 = load i32, i32* %41
%43 = add nsw i32 %42, %33
store i32 %43, i32* %41
br label %44
44: ; preds = %24
%45 = load i32, i32* %4
%46 = add nsw i32 %45, 1
store i32 %46, i32* %4
br label %21
47: ; preds = %21
br label %48
48: ; preds = %47
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
store i32 %50, i32* %3
br label %17
51: ; preds = %17
br label %52
52: ; preds = %51, %0
%53 = load [4 x i32]*, [4 x i32]** %1
ret [4 x i32]* %53
}

LLVM IR (-O2):
@__const.func_pointer_012_func_001.arr = [4 x [4 x i32]] [[4 x i32] [i32 1, i32 2, i32 3, i32 4], [4 x i32] [i32 11, i32 22, i32 33, i32 44], [4 x i32] [i32 33, i32 44, i32 55, i32 66], [4 x i32] [i32 55, i32 66, i32 77, i32 88]]
define [4 x i32]* @func_pointer_012_func_001() {
%1 = alloca [4 x [4 x i32]]
%2 = bitcast [4 x [4 x i32]]* %1 to i8*
%3 = tail call i64 @malloc(i32 64)
%4 = inttoptr i64 %3 to [4 x i32]*
%5 = icmp eq i64 %3, 0
br i1 %5, label %29, label %6
6: ; preds = %0
%7 = inttoptr i64 %3 to i32**
%8 = bitcast [4 x [4 x i32]]* %1 to i32**
%9 = call i32 @memcpy(i32** %7, i32** %8, i32 64)
%10 = inttoptr i64 %3 to <4 x i32>*
%11 = load <4 x i32>, <4 x i32>* %10
%12 = shl nsw <4 x i32> %11, <i32 1, i32 1, i32 1, i32 1>
%13 = inttoptr i64 %3 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %13
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 1, i64 0
%15 = bitcast i32* %14 to <4 x i32>*
%16 = load <4 x i32>, <4 x i32>* %15
%17 = shl nsw <4 x i32> %16, <i32 1, i32 1, i32 1, i32 1>
%18 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %18
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 2, i64 0
%20 = bitcast i32* %19 to <4 x i32>*
%21 = load <4 x i32>, <4 x i32>* %20
%22 = shl nsw <4 x i32> %21, <i32 1, i32 1, i32 1, i32 1>
%23 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %23
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 3, i64 0
%25 = bitcast i32* %24 to <4 x i32>*
%26 = load <4 x i32>, <4 x i32>* %25
%27 = shl nsw <4 x i32> %26, <i32 1, i32 1, i32 1, i32 1>
%28 = bitcast i32* %24 to <4 x i32>*
store <4 x i32> %27, <4 x i32>* %28
br label %29
29: ; preds = %6, %0
ret [4 x i32]* %4
}