#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 EXIT_SUCCESS;
int **pf();
int /*<<< orphan*/ print(int **);
int main(void) {
  int(*array)[50] = pf();
  for (int i = 0; i < 50; i++)
    *(*array + i) = i * i;
  print(array);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <pf@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x32,-0x14(%rbp)
jge    116b <main+0x4b>
mov    -0x14(%rbp),%edx
imul   -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1141 <main+0x21>
mov    -0x10(%rbp),%rdi
call   1040 <print@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <pf@plt>
mov    $0x4,%ecx
nopl   (%rax)
lea    -0x4(%rcx),%edx
imul   %edx,%edx
mov    %edx,-0x10(%rax,%rcx,4)
lea    -0x3(%rcx),%edx
imul   %edx,%edx
mov    %edx,-0xc(%rax,%rcx,4)
lea    -0x2(%rcx),%edx
imul   %edx,%edx
mov    %edx,-0x8(%rax,%rcx,4)
lea    -0x1(%rcx),%edx
imul   %edx,%edx
mov    %edx,-0x4(%rax,%rcx,4)
mov    %ecx,%edx
imul   %ecx,%edx
mov    %edx,(%rax,%rcx,4)
add    $0x5,%rcx
cmp    $0x36,%rcx
jne    1130 <main+0x10>
mov    %rax,%rdi
call   1040 <print@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i32]*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32** (...) @pf()
%5 = bitcast i32** %4 to [50 x i32]*
store [50 x i32]* %5, [50 x i32]** %2
store i32 0, i32* %3
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 50
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = mul nsw i32 %10, %11
%13 = load [50 x i32]*, [50 x i32]** %2
%14 = getelementptr inbounds [50 x i32], [50 x i32]* %13, i64 0, i64 0
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
store i32 %12, i32* %17
br label %18
18: ; preds = %9
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %6
21: ; preds = %6
%22 = load [50 x i32]*, [50 x i32]** %2
%23 = bitcast [50 x i32]* %22 to i32**
%24 = call i32 @print(i32** %23)
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32** (...) @pf()
%2 = bitcast i32** %1 to i32*
br label %6
3: ; preds = %6
%4 = tail call i32 @print(i32** %1)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
6: ; preds = %6, %0
%7 = phi i64 [ 0, %0 ], [ %27, %6 ]
%8 = mul nuw nsw i64 %7, %7
%9 = getelementptr inbounds i32, i32* %2, i64 %7
%10 = trunc i64 %8 to i32
store i32 %10, i32* %9
%11 = add nuw nsw i64 %7, 1
%12 = mul nuw nsw i64 %11, %11
%13 = getelementptr inbounds i32, i32* %2, i64 %11
%14 = trunc i64 %12 to i32
store i32 %14, i32* %13
%15 = add nuw nsw i64 %7, 2
%16 = mul nuw nsw i64 %15, %15
%17 = getelementptr inbounds i32, i32* %2, i64 %15
%18 = trunc i64 %16 to i32
store i32 %18, i32* %17
%19 = add nuw nsw i64 %7, 3
%20 = mul nuw nsw i64 %19, %19
%21 = getelementptr inbounds i32, i32* %2, i64 %19
%22 = trunc i64 %20 to i32
store i32 %22, i32* %21
%23 = add nuw nsw i64 %7, 4
%24 = mul nuw nsw i64 %23, %23
%25 = getelementptr inbounds i32, i32* %2, i64 %23
%26 = trunc i64 %24 to i32
store i32 %26, i32* %25
%27 = add nuw nsw i64 %7, 5
%28 = icmp eq i64 %27, 50
br i1 %28, label %3, label %6
}