#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 *s = "haha";
  printf("%c\n\n", *s);
  printf("%c\n", *(s + 0));
  printf("%c\n", *(s + 1));
  printf("%c\n", *(s + 2));
  printf("%c\n", *(s + 3));
  printf("%c\n", *(s + 4));
  printf("%c\n", *s + 0);
  printf("%c\n", *s + 1);
  printf("%c\n", *s + 2);
  printf("%c\n", *s + 3);
  printf("%c\n", *s + 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xed0(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xec2(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xeaf(%rip),%rdi
movsbl 0x1(%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xe9b(%rip),%rdi
movsbl 0x2(%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xe87(%rip),%rdi
movsbl 0x3(%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
lea    0xe73(%rip),%rdi
movsbl 0x4(%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0x0,%eax
lea    0xe59(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0x1,%eax
lea    0xe40(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0x2,%eax
lea    0xe27(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0x3,%eax
lea    0xe0e(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0x4,%eax
lea    0xdf5(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
mov    $0x68,%esi
call   1030 <printf@plt>
lea    0xedc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x68,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x68,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x68,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x69,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6a,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6b,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6c,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%c\0A\0A\00"
@.str.2 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext 104)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 104)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 97)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 104)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 97)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 104)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 105)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 106)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 107)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 signext 108)
ret i32 0
}