#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 stringPointer() {
  char *string;
  string = "I am arr - 我是字符数组，我指向首元素的地址";
  printf("%s\n", string);
  printf("%c\n", *string);
  char string1[] = "I am String";
  char *string2 = string1;
  printf("%s\n", string2);
  printf("%c\n", string1[2]);
  printf("%c\n", *(string2 + 5));
}


x86 assembly (clang, -O0):
<stringPointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xef3(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xef1(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x12(%rbp),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movsbl 0x5(%rax),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringPointer>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rbx
mov    %rbx,%rdi
mov    $0x49,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movabs $0x727453206d612049,%rax
53 74 72
mov    %rax,(%rsp)
movl   $0x676e69,0x8(%rsp)
mov    %rsp,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x53,%esi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"I am arr - \E6\88\91\E6\98\AF\E5\AD\97\E7\AC\A6\E6\95\B0\E7\BB\84\EF\BC\8C\E6\88\91\E6\8C\87\E5\90\91\E9\A6\96\E5\85\83\E7\B4\A0\E7\9A\84\E5\9C\B0\E5\9D\80\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [4 x i8] c"%c\0A\00"
@__const.stringPointer.string1 = [12 x i8] c"I am String\00"
define void @stringPointer() {
%1 = alloca i8*
%2 = alloca [12 x i8]
%3 = alloca i8*
store i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = load i8*, i8** %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = bitcast [12 x i8]* %2 to i8*
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 5
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [60 x i8] c"I am arr - \E6\88\91\E6\98\AF\E5\AD\97\E7\AC\A6\E6\95\B0\E7\BB\84\EF\BC\8C\E6\88\91\E6\8C\87\E5\90\91\E9\A6\96\E5\85\83\E7\B4\A0\E7\9A\84\E5\9C\B0\E5\9D\80\00"
@.str.2 = [4 x i8] c"%c\0A\00"
@__const.stringPointer.string1 = [12 x i8] c"I am String\00"
define void @stringPointer() {
%1 = alloca [12 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 73)
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%5 = call i32 @puts(i8* %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 97)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 83)
ret void
}