#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, char, char);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  int i;
  char a[] = "CCu";
  char b[3];
  strcpy(b, a);
  for (i = 0; i < 4; i++)
    printf("b[%d] = %c (%d)\n", i, b[i], b[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0xf(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1187 <main+0x67>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0xf(%rbp,%rax,1),%cl
movslq -0x8(%rbp),%rax
lea    0xe98(%rip),%rdi
movsbl %cl,%edx
movsbl -0xf(%rbp,%rax,1),%ecx
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114c <main+0x2c>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x754343,0xc(%rsp)
lea    0x9(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1030 <strcpy@plt>
movsbl 0x9(%rsp),%ecx
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ecx,%edx
call   1040 <printf@plt>
movsbl 0xa(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %ecx,%edx
call   1040 <printf@plt>
movsbl 0xb(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %ecx,%edx
call   1040 <printf@plt>
movsbl 0xc(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %ecx,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"b[%d] = %c (%d)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = bitcast i32* %1 to i8*
store i32 7684931, i32* %1
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %3)
%6 = load i8, i8* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 0, i8 signext %6, i8 signext %6)
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
%9 = load i8, i8* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1, i8 signext %9, i8 signext %9)
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
%12 = load i8, i8* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 2, i8 signext %12, i8 signext %12)
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 3
%15 = load i8, i8* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 3, i8 signext %15, i8 signext %15)
ret i32 0
}