#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 line[10] = "157adk";
  char *p = line;
  printf("whole string = '%s';\n", line);
  printf("\nbefore p = %p, * p = %c;\n\n", p, *p);
  *++p;
  printf("\nafter p = %p, * p = %c;\n\n", p, *p);
  printf("* ( p - 1 ) = %c;\n", *(p - 1));
  printf("\nafter p = %p, * p = %c;\n\n", p, *p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xed7(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xe(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movsbl -0x1(%rax),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x6b6461373531,%rax
mov    %rax,0x8(%rsp)
movw   $0x0,0x10(%rsp)
lea    0xed6(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x8(%rsp),%edx
lea    0xed1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x9(%rsp),%r14
movsbl 0x9(%rsp),%edx
lea    0xed2(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x8(%rsp),%esi
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x9(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.line = [10 x i8] c"157adk\00\00\00\00"
@.str = [22 x i8] c"whole string = '%s';\0A\00"
@.str.1 = [28 x i8] c"\0Abefore p = %p, * p = %c;\0A\0A\00"
@.str.2 = [27 x i8] c"\0Aafter p = %p, * p = %c;\0A\0A\00"
@.str.3 = [19 x i8] c"* ( p - 1 ) = %c;\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [10 x i8]* %2 to i8*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
store i8* %5, i8** %3
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %11)
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8, i8* %14
%16 = load i8*, i8** %3
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %16, i32 %19)
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 -1
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i8*, i8** %3
%27 = load i8*, i8** %3
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %26, i32 %29)
ret i32 0
}

LLVM IR (-O2):
@__const.main.line = [10 x i8] c"157adk\00\00\00\00"
@.str = [22 x i8] c"whole string = '%s';\0A\00"
@.str.1 = [28 x i8] c"\0Abefore p = %p, * p = %c;\0A\0A\00"
@.str.2 = [27 x i8] c"\0Aafter p = %p, * p = %c;\0A\0A\00"
@.str.3 = [19 x i8] c"* ( p - 1 ) = %c;\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 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 ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %7, i32 %9)
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i8, i8* %7
%15 = sext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %7, i32 %15)
ret i32 0
}