#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 *, ...);
void five() {
  char str[12] = {'z', 'h', 'a', 'n', 'g', 'r', 'x', 'i', 'a', 'n', 'g'};
  printf("str --> %s\n", str);
  printf("str[0]  --> %c\n", str[0]);
  char *p = str;
  printf("*p  --> %s\n", p);
  printf("*(++p)  --> %c\n", *(++p));
  printf("++p  --> %s\n", ++p);
}


x86 assembly (clang, -O0):
<five>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xedf(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0xc(%rbp),%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl 0x1(%rax),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    %rsi,-0x18(%rbp)
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<five>:
push   %rbx
sub    $0x10,%rsp
movabs $0x697872676e61687a,%rax
72 78 69
mov    %rax,(%rsp)
movl   $0x676e61,0x8(%rsp)
lea    0xeda(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl (%rsp),%esi
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x1(%rsp),%esi
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x2(%rsp),%rsi
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.five.str = [12 x i8] c"zhangrxiang\00"
@.str = [12 x i8] c"str --> %s\0A\00"
@.str.1 = [16 x i8] c"str[0] --> %c\0A\00"
@.str.2 = [12 x i8] c"*p --> %s\0A\00"
@.str.3 = [16 x i8] c"*(++p) --> %c\0A\00"
@.str.4 = [13 x i8] c"++p --> %s\0A\00"
define void @five() {
%1 = alloca [12 x i8]
%2 = alloca i8*
%3 = bitcast [12 x i8]* %1 to i8*
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %19)
ret void
}

LLVM IR (-O2):
@__const.five.str = [12 x i8] c"zhangrxiang\00"
@.str = [12 x i8] c"str --> %s\0A\00"
@.str.1 = [16 x i8] c"str[0] --> %c\0A\00"
@.str.2 = [12 x i8] c"*p --> %s\0A\00"
@.str.3 = [16 x i8] c"*(++p) --> %c\0A\00"
@.str.4 = [13 x i8] c"++p --> %s\0A\00"
define void @five() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 2
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %12)
ret void
}