#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 f2(char *s2) {
  int i = 0;
  printf("in f2:\n");
  for (i = 0; i <= 9; i++) {
    printf(
        "at step %d * s2 = \"%c\" in char; %d in digital and %p as pointer;\n",
        i, *s2, *s2, *s2);
    *s2++;
  };
  printf("---in f2---\n---after first cycle---\n");
  for (i = 0; i < 5; i++) {
    *--s2;
  };
  i = 0;
  while (*s2 != '\0') {
    printf(
        "at step %d * s2 = \"%c\" in char and %d in digit; and %p as pointer\n",
        i, *s2, *s2, *s2);
    *s2++;
    i++;
  }
  printf("end of f2.\n");
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jg     1183 <f2+0x73>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x8(%rbp),%rax
movsbl (%rax),%r8d
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <f2+0x28>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11bc <f2+0xac>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1198 <f2+0x88>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1214 <f2+0x104>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x8(%rbp),%rax
movsbl (%rax),%r8d
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c3 <f2+0xb3>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xf56(%rip),%rdi
call   1030 <puts@plt>
movsbl (%r15),%ecx
lea    0xec1(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x1(%r15),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x2(%r15),%ecx
mov    %r14,%rdi
mov    $0x2,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x3(%r15),%ecx
mov    %r14,%rdi
mov    $0x3,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x4(%r15),%ecx
mov    %r14,%rdi
mov    $0x4,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x5(%r15),%ecx
mov    %r14,%rdi
mov    $0x5,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x6(%r15),%ecx
mov    %r14,%rdi
mov    $0x6,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x7(%r15),%ecx
mov    %r14,%rdi
mov    $0x7,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x8(%r15),%ecx
mov    %r14,%rdi
mov    $0x8,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x9(%r15),%ecx
mov    %r14,%rdi
mov    $0x9,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
mov    0x5(%r15),%al
test   %al,%al
je     1272 <f2+0x152>
lea    0xdf6(%rip),%r14
xor    %ebx,%ebx
xchg   %ax,%ax
movsbl %al,%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x6(%r15,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1250 <f2+0x130>
lea    0xe37(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"in f2:\0A\00"
@.str.1 = [66 x i8] c"at step %d * s2 = \22%c\22 in char; %d in digital and %p as pointer;\0A\00"
@.str.2 = [37 x i8] c"---in f2---\0A---after first cycle---\0A\00"
@.str.3 = [67 x i8] c"at step %d * s2 = \22%c\22 in char and %d in digit; and %p as pointer\0A\00"
@.str.4 = [12 x i8] c"end of f2.\0A\00"
define void @f2(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %23, %1
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 9
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = load i8*, i8** %2
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %12, i32 %15, i32 %18)
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %2
%22 = load i8, i8* %20
br label %23
23: ; preds = %8
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %5
26: ; preds = %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %28
28: ; preds = %35, %26
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 5
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i32 -1
store i8* %33, i8** %2
%34 = load i8, i8* %33
br label %35
35: ; preds = %31
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %28
38: ; preds = %28
store i32 0, i32* %3
br label %39
39: ; preds = %44, %38
%40 = load i8*, i8** %2
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %61
44: ; preds = %39
%45 = load i32, i32* %3
%46 = load i8*, i8** %2
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = load i8*, i8** %2
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = load i8*, i8** %2
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.3, i64 0, i64 0), i32 %45, i32 %48, i32 %51, i32 %54)
%56 = load i8*, i8** %2
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %2
%58 = load i8, i8* %56
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %39
61: ; preds = %39
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [66 x i8] c"at step %d * s2 = \22%c\22 in char; %d in digital and %p as pointer;\0A\00"
@.str.3 = [67 x i8] c"at step %d * s2 = \22%c\22 in char and %d in digit; and %p as pointer\0A\00"
@str = [7 x i8] c"in f2:\00"
@str.5 = [36 x i8] c"---in f2---\0A---after first cycle---\00"
@str.6 = [11 x i8] c"end of f2.\00"
define void @f2(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %4, i32 %4, i32 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %8, i32 %8, i32 %8)
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %12, i32 %12, i32 %12)
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %16, i32 %16, i32 %16)
%18 = getelementptr inbounds i8, i8* %0, i64 4
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %20, i32 %20, i32 %20)
%22 = getelementptr inbounds i8, i8* %0, i64 5
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %24, i32 %24, i32 %24)
%26 = getelementptr inbounds i8, i8* %0, i64 6
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %28, i32 %28, i32 %28)
%30 = getelementptr inbounds i8, i8* %0, i64 7
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %32, i32 %32, i32 %32)
%34 = getelementptr inbounds i8, i8* %0, i64 8
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %36, i32 %36, i32 %36)
%38 = getelementptr inbounds i8, i8* %0, i64 9
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %40, i32 %40, i32 %40)
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.5, i64 0, i64 0))
%43 = load i8, i8* %22
%44 = icmp eq i8 %43, 0
br i1 %44, label %55, label %45
45: ; preds = %1, %45
%46 = phi i8 [ %53, %45 ], [ %43, %1 ]
%47 = phi i32 [ %52, %45 ], [ 0, %1 ]
%48 = phi i8* [ %51, %45 ], [ %22, %1 ]
%49 = sext i8 %46 to i32
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.3, i64 0, i64 0), i32 %47, i32 %49, i32 %49, i32 %49)
%51 = getelementptr inbounds i8, i8* %48, i64 1
%52 = add nuw nsw i32 %47, 1
%53 = load i8, i8* %51
%54 = icmp eq i8 %53, 0
br i1 %54, label %55, label %45
55: ; preds = %45, %1
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.6, i64 0, i64 0))
ret void
}