#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 *, char *);
void main() {
  char text_1[100], text_2[100], text_3[100];
  char *ta, *tb;
  int i;
  char message[] = "Hello, I am a string; what are you?";
  printf("Original message: %s\n", message);
  i = 0;
  while ((text_1[i] = message[i]) != '\0') {
    i++;
  }
  printf("Text_1: %s\n", text_1);
  ta = message;
  tb = text_2;
  while ((*tb++ = *ta++) != '\0') {
    ;
  }
  printf("Text_2: %s\n", text_2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
lea    -0x190(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x190(%rbp),%rsi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x164(%rbp)
movslq -0x164(%rbp),%rax
mov    -0x190(%rbp,%rax,1),%al
movslq -0x164(%rbp),%rcx
mov    %al,-0x70(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     1199 <main+0x79>
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1160 <main+0x40>
lea    -0x70(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
lea    -0x190(%rbp),%rax
mov    %rax,-0x158(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x158(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x158(%rbp)
mov    (%rax),%al
mov    -0x160(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x160(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1204 <main+0xe4>
jmp    11c5 <main+0xa5>
lea    -0xe0(%rbp),%rsi
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x108,%rsp
movaps 0xef2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x3f756f,0x20(%rsp)
lea    0xee7(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movzbl (%rsp,%rax,1),%ecx
mov    %cl,0xa0(%rsp,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1150 <main+0x40>
lea    0xed0(%rip),%rdi
lea    0xa0(%rsp),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
nopl   0x0(%rax)
movzbl (%rsp,%rax,1),%ecx
mov    %cl,0x30(%rsp,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1180 <main+0x70>
lea    0xeaf(%rip),%rdi
lea    0x30(%rsp),%rsi
call   1030 <printf@plt>
add    $0x108,%rsp
ret

LLVM IR (-O0):
@__const.main.message = [36 x i8] c"Hello, I am a string; what are you?\00"
@.str = [22 x i8] c"Original message: %s\0A\00"
@.str.1 = [12 x i8] c"Text_1: %s\0A\00"
@.str.2 = [12 x i8] c"Text_2: %s\0A\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [36 x i8]
%8 = bitcast [36 x i8]* %7 to i8*
%9 = getelementptr inbounds [36 x i8], [36 x i8]* %7, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %9)
store i32 0, i32* %6
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [36 x i8], [36 x i8]* %7, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %17
store i8 %15, i8* %18
%19 = sext i8 %15 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %11
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %11
24: ; preds = %11
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%26 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [36 x i8], [36 x i8]* %7, i64 0, i64 0
store i8* %27, i8** %4
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8* %28, i8** %5
br label %29
29: ; preds = %37, %24
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %4
%32 = load i8, i8* %30
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %5
store i8 %32, i8* %33
%35 = sext i8 %32 to i32
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %29
br label %29
38: ; preds = %29
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%40 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %39)
ret void
}

LLVM IR (-O2):
@__const.main.message = [36 x i8] c"Hello, I am a string; what are you?\00"
@.str = [22 x i8] c"Original message: %s\0A\00"
@.str.1 = [12 x i8] c"Text_1: %s\0A\00"
@.str.2 = [12 x i8] c"Text_2: %s\0A\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [36 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [36 x i8], [36 x i8]* %3, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %8, %0
%9 = phi i64 [ %14, %8 ], [ 0, %0 ]
%10 = getelementptr inbounds [36 x i8], [36 x i8]* %3, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %9
store i8 %11, i8* %12
%13 = icmp eq i8 %11, 0
%14 = add nuw i64 %9, 1
br i1 %13, label %15, label %8
15: ; preds = %8
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %17
17: ; preds = %17, %15
%18 = phi i8* [ %6, %15 ], [ %20, %17 ]
%19 = phi i8* [ %5, %15 ], [ %22, %17 ]
%20 = getelementptr inbounds i8, i8* %18, i64 1
%21 = load i8, i8* %18
%22 = getelementptr inbounds i8, i8* %19, i64 1
store i8 %21, i8* %19
%23 = icmp eq i8 %21, 0
br i1 %23, label %24, label %17
24: ; preds = %17
%25 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret void
}