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

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ funktion(int *, int);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ system(char *);
int main(void) {
  setbuf(stdout, NULL);
  system("cls");
  int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  int val[10];
  for (int i = 0; i < 10; i++) {
    val[i] = i + 1;
  }
  funktion(&val[0], sizeof(val) / sizeof(int));
  funktion(arr, sizeof(arr) / sizeof(int));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
lea    0xe98(%rip),%rdi
call   1040 <system@plt>
lea    -0x30(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    11af <main+0x6f>
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1189 <main+0x49>
lea    -0x60(%rbp),%rdi
mov    $0xa,%esi
call   1060 <funktion@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1060 <funktion@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <setbuf@plt>
lea    0xed5(%rip),%rdi
call   1040 <system@plt>
mov    0xef9(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe85(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xe8a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0xa00000009,%rax
mov    %rax,0x20(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1050 <funktion@plt>
lea    0x30(%rsp),%rdi
mov    $0xa,%esi
call   1050 <funktion@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c"cls\00"
@__const.main.arr = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca [10 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @stdout
%6 = call i32 @setbuf(i32 %5, i32* null)
%7 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = bitcast [10 x i32]* %2 to i8*
store i32 0, i32* %4
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %16
store i32 %14, i32* %17
br label %18
18: ; preds = %12
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %9
21: ; preds = %9
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%23 = call i32 @funktion(i32* %22, i32 10)
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%25 = call i32 @funktion(i32* %24, i32 10)
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"cls\00"
@__const.main.arr = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i32]
%3 = load i32, i32* @stdout
%4 = tail call i32 @setbuf(i32 %3, i32* null)
%5 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = bitcast [10 x i32]* %1 to i8*
%7 = bitcast [10 x i32]* %2 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = bitcast [10 x i32]* %2 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %11
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 8
store i32 9, i32* %12
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
store i32 10, i32* %13
%14 = call i32 @funktion(i32* %8, i32 10)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%16 = call i32 @funktion(i32* %15, i32 10)
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}