#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 *);
int main(void) {
  char string_1[] = " Hallo";
  char string_2[20] = "Halli";
  int length_2 = 0;
  while (string_2[length_2] != '\0') {
    length_2 += 1;
  }
  int index = 0;
  while ((string_2[index + length_2] = string_1[index]) != '\0') {
    index += 1;
  }
  printf("string_2 = %s\n", string_2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1182 <main+0x72>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1162 <main+0x52>
movl   $0x0,-0x28(%rbp)
movslq -0x28(%rbp),%rax
mov    -0xb(%rbp,%rax,1),%al
mov    -0x28(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
mov    %al,-0x20(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     11b8 <main+0xa8>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1189 <main+0x79>
lea    -0x20(%rbp),%rsi
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
xor    %eax,%eax
nopl   0x0(%rax)
cmpb   $0x0,0x1(%rsp,%rax,1)
lea    0x1(%rax),%rax
jne    1130 <main+0x20>
mov    %eax,%eax
movl   $0x6f6c6c,0x3(%rsp,%rax,1)
movl   $0x6c614820,(%rsp,%rax,1)
lea    0xeb4(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.string_1 = [7 x i8] c" Hallo\00"
@__const.main.string_2 = [20 x i8] c"Halli\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [15 x i8] c"string_2 = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [20 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [7 x i8]* %2 to i8*
%7 = bitcast [20 x i8]* %3 to i8*
store i32 0, i32* %4
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %8
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %8
18: ; preds = %8
store i32 0, i32* %5
br label %19
19: ; preds = %31, %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = load i32, i32* %5
%25 = load i32, i32* %4
%26 = add nsw i32 %24, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 %27
store i8 %23, i8* %28
%29 = sext i8 %23 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %19
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %19
34: ; preds = %19
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%36 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %35)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string_1 = [7 x i8] c" Hallo\00"
@__const.main.string_2 = [20 x i8] c"Halli\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [15 x i8] c"string_2 = %s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 1, %0 ], [ %8, %3 ]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = and i64 %4, 4294967295
%11 = getelementptr [20 x i8], [20 x i8]* %1, i64 0, i64 %10
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}