#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(void) {
  int a = 0;
  printf("%p,%c\n", "abc", *"abc");
  printf("%p,%c\n", "abc" + 1, *("abc" + 1));
  printf("%p,%c\n", "abc" + 2, *("abc" + 2));
  printf("%p,%c\n", "abc" + 3, *("abc" + 3));
  printf("%p,%d\n", "abc" + 3, *("abc" + 3));
  char array[10] = "def";
  char *p = "def";
  int i;
  for (i = 0; array[i] != '\0'; i++) {
    printf("array[%d]\t%p,%c\n", i, &array[i], array[i]);
  }
  printf("&p=%p\n", &p);
  for (i = 0; p[i] != '\0'; i++) {
    printf("(p+%d)\t%p,%c\n", i, p + i, *(p + i));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl 0xed3(%rip),%edx
lea    0xefa(%rip),%rdi
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl 0xeb8(%rip),%edx
lea    0xede(%rip),%rdi
lea    0xea9(%rip),%rsi
add    $0x1,%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl 0xe99(%rip),%edx
lea    0xebe(%rip),%rdi
lea    0xe89(%rip),%rsi
add    $0x2,%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl 0xe7a(%rip),%edx
lea    0xe9e(%rip),%rdi
lea    0xe69(%rip),%rsi
add    $0x3,%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl 0xe5a(%rip),%edx
lea    0xe54(%rip),%rdi
lea    0xe49(%rip),%rsi
add    $0x3,%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe6c(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xe69(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    0xe2c(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     122f <main+0x11f>
mov    -0x24(%rbp),%esi
movslq -0x24(%rbp),%rax
lea    -0x12(%rbp),%rdx
add    %rax,%rdx
movslq -0x24(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%ecx
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ea <main+0xda>
lea    0xdea(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1293 <main+0x183>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
movslq -0x24(%rbp),%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1248 <main+0x138>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xf10(%rip),%rbx
lea    0xedb(%rip),%rsi
mov    %rbx,%rdi
mov    $0x61,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x62,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x63,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9c(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movw   $0x0,0x10(%rsp)
movq   $0x666564,0x8(%rsp)
lea    0xe6b(%rip),%rax
mov    %rax,(%rsp)
mov    $0x64,%al
lea    0xe62(%rip),%r14
xor    %ebx,%ebx
nop
lea    (%rsp,%rbx,1),%rdx
add    $0x8,%rdx
movsbl %al,%ecx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movzbl 0x9(%rsp,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    11b0 <main+0xa0>
lea    0xe45(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rdx
mov    (%rdx),%al
test   %al,%al
je     1223 <main+0x113>
mov    $0x1,%ebx
lea    0xe2c(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl %al,%ecx
lea    -0x1(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rdx
movzbl (%rdx,%rbx,1),%eax
add    %rbx,%rdx
add    $0x1,%rbx
test   %al,%al
jne    1200 <main+0xf0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%p,%c\0A\00"
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [7 x i8] c"%p,%d\0A\00"
@__const.main.array = [10 x i8] c"def\00\00\00\00\00\00\00"
@.str.3 = [4 x i8] c"def\00"
@.str.4 = [17 x i8] c"array[%d]\09%p,%c\0A\00"
@.str.5 = [7 x i8] c"&p=%p\0A\00"
@.str.6 = [14 x i8] c"(p+%d)\09%p,%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%6 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%7 = sext i8 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 1)
%10 = sext i8 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 1), i32 %10)
%12 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 2)
%13 = sext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 2), i32 %13)
%15 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 3)
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 3), i32 %16)
%18 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 3)
%19 = sext i8 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 3), i32 %19)
%21 = bitcast [10 x i8]* %3 to i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %4
store i32 0, i32* %5
br label %22
22: ; preds = %40, %0
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %43
29: ; preds = %22
%30 = load i32, i32* %5
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %32
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %30, i8* %33, i32 %38)
br label %40
40: ; preds = %29
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %22
43: ; preds = %22
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %4)
store i32 0, i32* %5
br label %45
45: ; preds = %66, %43
%46 = load i8*, i8** %4
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %69
53: ; preds = %45
%54 = load i32, i32* %5
%55 = load i8*, i8** %4
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8*, i8** %4
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %54, i8* %58, i32 %64)
br label %66
66: ; preds = %53
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
store i32 %68, i32* %5
br label %45
69: ; preds = %45
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%p,%c\0A\00"
@.str.1 = [4 x i8] c"abc\00"
@.str.2 = [7 x i8] c"%p,%d\0A\00"
@__const.main.array = [10 x i8] c"def\00\00\00\00\00\00\00"
@.str.3 = [4 x i8] c"def\00"
@.str.4 = [17 x i8] c"array[%d]\09%p,%c\0A\00"
@.str.5 = [7 x i8] c"&p=%p\0A\00"
@.str.6 = [14 x i8] c"(p+%d)\09%p,%c\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 97)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 1), i32 98)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 2), i32 99)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 3), i32 0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 3), i32 0)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%9 = bitcast i8** %2 to i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %10
10: ; preds = %0, %10
%11 = phi i64 [ 0, %0 ], [ %17, %10 ]
%12 = phi i8 [ 100, %0 ], [ %19, %10 ]
%13 = phi i8* [ %8, %0 ], [ %18, %10 ]
%14 = sext i8 %12 to i32
%15 = trunc i64 %11 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %15, i8* %13, i32 %14)
%17 = add nuw i64 %11, 1
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %10
21: ; preds = %10
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %2)
%23 = load i8*, i8** %2
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %38, label %26
26: ; preds = %21, %26
%27 = phi i64 [ %33, %26 ], [ 0, %21 ]
%28 = phi i8 [ %36, %26 ], [ %24, %21 ]
%29 = phi i8* [ %35, %26 ], [ %23, %21 ]
%30 = sext i8 %28 to i32
%31 = trunc i64 %27 to i32
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %31, i8* %29, i32 %30)
%33 = add nuw i64 %27, 1
%34 = load i8*, i8** %2
%35 = getelementptr inbounds i8, i8* %34, i64 %33
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %38, label %26
38: ; preds = %26, %21
ret i32 0
}