#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], *p1, *p2;
  int i;
  p1 = a;
  p2 = b;
  for (; *p1 != '\0'; p1++, p2++)
    *p2 = *p1;
  *p2 = '\0';
  printf("string a is: %s \n", a);
  printf("string b is: ");
  for (i = 0; b[i] != '\0'; i++)
    printf("%c", b[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117c <main+0x6c>
mov    -0x38(%rbp),%rax
mov    (%rax),%cl
mov    -0x40(%rbp),%rax
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1143 <main+0x33>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x10(%rbp),%rsi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11e1 <main+0xd1>
movslq -0x44(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11aa <main+0x9a>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

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

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

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