#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 *malloc(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int *tabelle = malloc(5 * 6 * sizeof(int));
  *tabelle = 13;
  *(tabelle + 1) = 42;
  int i;
  for (i = 0; i < 10; i++) {
    printf("tabelle[%d]: %d\n", i, tabelle[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x78,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xd,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2a,0x4(%rax)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    118b <main+0x6b>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1159 <main+0x39>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x78,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xec8(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xd,%edx
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x2a,%edx
call   1030 <printf@plt>
mov    0x8(%rbx),%edx
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0xc(%rbx),%edx
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x10(%rbx),%edx
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x14(%rbx),%edx
mov    %r14,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x18(%rbx),%edx
mov    %r14,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    0x1c(%rbx),%edx
mov    %r14,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x20(%rbx),%edx
mov    %r14,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x24(%rbx),%edx
mov    %r14,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"tabelle[%d]: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32* @malloc(i32 120)
store i32* %4, i32** %2
%5 = load i32*, i32** %2
store i32 13, i32* %5
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 42, i32* %7
store i32 0, i32* %3
br label %8
8: ; preds = %19, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %3
%13 = load i32*, i32** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %8
22: ; preds = %8
ret i32 0
}

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