#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 /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int main(void) {
  char string1[] = "a1", *string2;
  string2 = string1;
  printf("*string2++"
         " = [%c]\n",
         (*string2++));
  printf("*string2++"
         " = [%c]\n",
         (*string2++));
  putchar('\n');
  string2 = string1;
  printf("*(string2++)"
         " = [%c]\n",
         (*(string2++)));
  printf("*(string2++)"
         " = [%c]\n",
         (*(string2++)));
  putchar('\n');
  string2 = string1;
  printf("(*string2)++"
         " = [%c]\n",
         ((*string2)++));
  printf("(*string2)++"
         " = [%c]\n",
         ((*string2)++));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xec2(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x7(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%esi
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%esi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x7(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%esi
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%esi
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x7(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%al
mov    %al,%dl
add    $0x1,%dl
mov    %dl,(%rcx)
movsbl %al,%esi
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%al
mov    %al,%dl
add    $0x1,%dl
mov    %dl,(%rcx)
movsbl %al,%esi
lea    0xe11(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x31,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xec0(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x31,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeaa(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x62,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.string1 = [3 x i8] c"a1\00"
@.str = [19 x i8] c"*string2++ = [%c]\0A\00"
@.str.1 = [21 x i8] c"*(string2++) = [%c]\0A\00"
@.str.2 = [21 x i8] c"(*string2)++ = [%c]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [3 x i8]* %2 to i8*
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @putchar(i8 signext 10)
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
store i8* %17, i8** %3
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
%20 = load i8, i8* %18
%21 = sext i8 %20 to i32
%22 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
%25 = load i8, i8* %23
%26 = sext i8 %25 to i32
%27 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @putchar(i8 signext 10)
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
store i8* %29, i8** %3
%30 = load i8*, i8** %3
%31 = load i8, i8* %30
%32 = add i8 %31, 1
store i8 %32, i8* %30
%33 = sext i8 %31 to i32
%34 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = load i8*, i8** %3
%36 = load i8, i8* %35
%37 = add i8 %36, 1
store i8 %37, i8* %35
%38 = sext i8 %36 to i32
%39 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"*string2++ = [%c]\0A\00"
@.str.1 = [21 x i8] c"*(string2++) = [%c]\0A\00"
@.str.2 = [21 x i8] c"(*string2)++ = [%c]\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 97)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 49)
%3 = tail call i32 @putchar(i8 signext 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 97)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 49)
%6 = tail call i32 @putchar(i8 signext 10)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 97)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 98)
ret i32 0
}