#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*/ getNums(int *);
int /*<<< orphan*/ getNums2(int *);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i, nums[4];
  int *ptr;
  ptr = nums;
  getNums(ptr);
  for (i = 0; i < 4; i++)
    printf("Nums[%i] = %i\n", i, nums[i]);
  getNums2(nums);
  for (i = 0; i < 4; i++) {
    printf("Nums[%i] = %i\n", i, *ptr);
    ptr++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <getNums@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1186 <main+0x56>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1157 <main+0x27>
lea    -0x20(%rbp),%rdi
call   1030 <getNums2@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11cf <main+0x9f>
mov    -0x8(%rbp),%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x66>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%r14
mov    %r14,%rdi
call   1050 <getNums@plt>
mov    (%rsp),%edx
lea    0xeb4(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <getNums2@plt>
mov    (%rsp),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Nums[%i] = %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x i32]
%4 = alloca i32*
store i32 0, i32* %1
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
store i32* %5, i32** %4
%6 = load i32*, i32** %4
%7 = call i32 @getNums(i32* %6)
store i32 0, i32* %2
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %2
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %8
21: ; preds = %8
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%23 = call i32 @getNums2(i32* %22)
store i32 0, i32* %2
br label %24
24: ; preds = %34, %21
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 4
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = load i32, i32* %2
%29 = load i32*, i32** %4
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %30)
%32 = load i32*, i32** %4
%33 = getelementptr inbounds i32, i32* %32, i32 1
store i32* %33, i32** %4
br label %34
34: ; preds = %27
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
store i32 %36, i32* %2
br label %24
37: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Nums[%i] = %i\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @getNums(i32* %3)
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0, i32 %5)
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1, i32 %8)
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 2, i32 %11)
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3, i32 %14)
%16 = call i32 @getNums2(i32* %3)
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0, i32 %17)
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1, i32 %20)
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 2, i32 %23)
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3, i32 %26)
ret i32 0
}