#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*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int tab1[5], tab2[10], i;
  for (i = 0; i < 5; i++) {
    printf("podaj tab1[%d]", i);
    scanf("%d", &tab1[i]);
  }
  for (i = 0; i < 5; i++) {
    tab2[i] = tab1[i];
    tab2[i + 5] = tab1[i] * 2;
  }
  for (i = 0; i < 10; i++) {
    printf("tab2[%d]=%d\n", i, tab2[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    117a <main+0x5a>
mov    -0x54(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x54(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea8(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    11c0 <main+0xa0>
movslq -0x54(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
movslq -0x54(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
shl    $0x1,%ecx
mov    -0x54(%rbp),%eax
add    $0x5,%eax
cltq
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1181 <main+0x61>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    11f8 <main+0xd8>
mov    -0x54(%rbp),%esi
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11c7 <main+0xa7>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xecb(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rbp
mov    %rsp,%rsi
mov    %rbp,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%edx
mov    0x4(%rsp),%r13d
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%r15d
mov    0x10(%rsp),%r14d
lea    (%rdx,%rdx,1),%ebp
lea    0x0(%r13,%r13,1),%eax
mov    %eax,0x18(%rsp)
lea    (%r12,%r12,1),%eax
mov    %eax,0x1c(%rsp)
lea    (%r15,%r15,1),%eax
mov    %eax,0x20(%rsp)
lea    (%r14,%r14,1),%eax
mov    %eax,0x24(%rsp)
lea    0xe0d(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    0x18(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    0x1c(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    0x20(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    0x24(%rsp),%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"podaj tab1[%d]\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"tab2[%d]=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [10 x i32]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i32, i32* %4
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
br label %15
15: ; preds = %8
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %5
18: ; preds = %5
store i32 0, i32* %4
br label %19
19: ; preds = %39, %18
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 5
br i1 %21, label %22, label %42
22: ; preds = %19
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %28
store i32 %26, i32* %29
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = mul nsw i32 %33, 2
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %37
store i32 %34, i32* %38
br label %39
39: ; preds = %22
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %19
42: ; preds = %19
store i32 0, i32* %4
br label %43
43: ; preds = %53, %42
%44 = load i32, i32* %4
%45 = icmp slt i32 %44, 10
br i1 %45, label %46, label %56
46: ; preds = %43
%47 = load i32, i32* %4
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %47, i32 %51)
br label %53
53: ; preds = %46
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %43
56: ; preds = %43
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"podaj tab1[%d]\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"tab2[%d]=%d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1)
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 4)
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %4
%19 = load i32, i32* %7
%20 = load i32, i32* %10
%21 = load i32, i32* %13
%22 = load i32, i32* %16
%23 = shl nsw i32 %18, 1
%24 = shl nsw i32 %19, 1
%25 = shl nsw i32 %20, 1
%26 = shl nsw i32 %21, 1
%27 = shl nsw i32 %22, 1
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %18)
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %19)
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %20)
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %21)
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %22)
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 %23)
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 6, i32 %24)
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 7, i32 %25)
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 %26)
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 9, i32 %27)
ret i32 0
}