#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 str[30] = {0};
  char *strDest = str;
  const char *strSrc = "Hello";
  char *address = strDest;
  while ((*strDest++ = *strSrc++) != '\0') {
    printf("%c - %s\n", *(strSrc - 1), address);
  }
  printf("--------------------------------------\n");
  printf("%s\n", address);
  printf("%s\n", strDest);
  printf("%s\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xeb2(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x40(%rbp)
mov    (%rax),%al
mov    -0x38(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x38(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     11a7 <main+0x87>
mov    -0x40(%rbp),%rax
movsbl -0x1(%rax),%esi
mov    -0x48(%rbp),%rdx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115a <main+0x3a>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movups %xmm0,0xe(%rsp)
movb   $0x48,(%rsp)
lea    0xec2(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    $0x48,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movb   $0x65,0x1(%rsp)
mov    %r14,%rdi
mov    $0x65,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movb   $0x6c,0x2(%rsp)
mov    %r14,%rdi
mov    $0x6c,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movb   $0x6c,0x3(%rsp)
mov    %r14,%rdi
mov    $0x6c,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
movb   $0x6f,0x4(%rsp)
mov    %r14,%rdi
mov    $0x6f,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x6(%rsp),%r14
movb   $0x0,0x5(%rsp)
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%c - %s\0A\00"
@str = [39 x i8] c"--------------------------------------\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 1
store i8 72, i8* %2
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 72, i8* %2)
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 2
store i8 101, i8* %3
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 101, i8* %2)
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 3
store i8 108, i8* %5
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 108, i8* %2)
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 4
store i8 108, i8* %7
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 108, i8* %2)
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 5
store i8 111, i8* %9
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 111, i8* %2)
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 6
store i8 0, i8* %11
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%15 = call i32 @puts(i8* %2)
%16 = call i32 @puts(i8* %13)
%17 = call i32 @puts(i8* %2)
ret i32 0
}