#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 main() {
  char a[] = "I am a boy.", b[20];
  int i;
  for (i = 0; *(a + i) != '\0'; i++)
    *(b + i) = *(a + i);
  *(b + i) = '\0';
  printf("string a is : %s \n", a);
  printf("string b is :");
  for (i = 0; *(b + i) != '\0'; i++)
    printf("%c", b[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
movsbl -0x10(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     116a <main+0x5a>
movslq -0x34(%rbp),%rax
mov    -0x10(%rbp,%rax,1),%cl
movslq -0x34(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113a <main+0x2a>
movslq -0x34(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11d1 <main+0xc1>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119a <main+0x8a>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movabs $0x622061206d612049,%rax
61 20 62
mov    %rax,(%rsp)
movl   $0x2e796f,0x8(%rsp)
mov    $0x49,%cl
xor    %eax,%eax
nop
mov    %cl,0x10(%rsp,%rax,1)
movzbl 0x1(%rsp,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1140 <main+0x20>
mov    %eax,%eax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0xead(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%al
test   %al,%al
je     11a3 <main+0x83>
lea    0x11(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1190 <main+0x70>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

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