#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);
int main(void) {
  int arrayA[10] = {1, 2, 3};
  int arrayB[10] = {};
  int i;
  for (i = 0; '\0' != arrayA[i]; i++) {
    arrayB[i] = arrayA[i];
  }
  arrayB[i] = '\0';
  for (i = 0; '\0' != arrayB[i]; i++)
    printf("arrayB[%d]=%d\n", i, arrayB[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x2,-0x2c(%rbp)
movl   $0x3,-0x28(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x0,-0x64(%rbp)
movslq -0x64(%rbp),%rcx
xor    %eax,%eax
cmp    -0x30(%rbp,%rcx,4),%eax
je     1199 <main+0x79>
movslq -0x64(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    116b <main+0x4b>
movslq -0x64(%rbp),%rax
movl   $0x0,-0x60(%rbp,%rax,4)
movl   $0x0,-0x64(%rbp)
movslq -0x64(%rbp),%rcx
xor    %eax,%eax
cmp    -0x60(%rbp,%rcx,4),%eax
je     11e1 <main+0xc1>
mov    -0x64(%rbp),%esi
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%edx
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11ac <main+0x8c>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movq   $0x0,0x50(%rsp)
movabs $0x200000001,%rax
mov    %rax,0x30(%rsp)
movl   $0x3,0x38(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
mov    $0x1,%ecx
xor    %eax,%eax
nopl   (%rax)
mov    %ecx,(%rsp,%rax,4)
mov    0x34(%rsp,%rax,4),%ecx
add    $0x1,%rax
test   %ecx,%ecx
jne    1160 <main+0x50>
mov    %eax,%eax
movl   $0x0,(%rsp,%rax,4)
mov    (%rsp),%edx
test   %edx,%edx
je     11a6 <main+0x96>
xor    %ebx,%ebx
lea    0xe78(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x4(%rsp,%rbx,4),%edx
add    $0x1,%rbx
test   %edx,%edx
jne    1190 <main+0x80>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"arrayB[%d]=%d\0A\00"
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 = bitcast [10 x i32]* %2 to i8*
%6 = bitcast i8* %5 to [10 x i32]*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i32 0, i32 0
store i32 1, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i32 0, i32 1
store i32 2, i32* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i32 0, i32 2
store i32 3, i32* %9
%10 = bitcast [10 x i32]* %3 to i8*
store i32 0, i32* %4
br label %11
11: ; preds = %25, %0
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp ne i32 0, %15
br i1 %16, label %17, label %28
17: ; preds = %11
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %23
store i32 %21, i32* %24
br label %25
25: ; preds = %17
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %11
28: ; preds = %11
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %30
store i32 0, i32* %31
store i32 0, i32* %4
br label %32
32: ; preds = %45, %28
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = icmp ne i32 0, %36
br i1 %37, label %38, label %48
38: ; preds = %32
%39 = load i32, i32* %4
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %39, i32 %43)
br label %45
45: ; preds = %38
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
store i32 %47, i32* %4
br label %32
48: ; preds = %32
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"arrayB[%d]=%d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i32]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 1, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 2, i32* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
store i32 3, i32* %6
%7 = bitcast [10 x i32]* %2 to i8*
br label %8
8: ; preds = %8, %0
%9 = phi i64 [ 0, %0 ], [ %12, %8 ]
%10 = phi i32 [ 1, %0 ], [ %14, %8 ]
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %9
store i32 %10, i32* %11
%12 = add nuw nsw i64 %9, 1
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = and i64 %12, 4294967295
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %17
store i32 0, i32* %18
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %16, %22
%23 = phi i64 [ %27, %22 ], [ 0, %16 ]
%24 = phi i32 [ %29, %22 ], [ %20, %16 ]
%25 = trunc i64 %23 to i32
%26 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %24)
%27 = add nuw i64 %23, 1
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %22
31: ; preds = %22, %16
ret i32 0
}