#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 f1(char *s1) {
  int i = 0;
  printf("in f1:\n");
  for (i = 0; i <= 5; i++) {
    printf(
        "at step %d * s1 = \"%c\" in char; %d in digital and %p as pointer;\n",
        i, *s1, *s1, *s1);
    *s1++;
  };
  printf("end of f1.\n");
}


x86 assembly (clang, -O0):
<f1>:
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   $0x5,-0xc(%rbp)
jg     1183 <f1+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 <f1+0x28>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
movsbl (%rbx),%ecx
lea    0xec3(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x1(%rbx),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x2(%rbx),%ecx
mov    %r14,%rdi
mov    $0x2,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x3(%rbx),%ecx
mov    %r14,%rdi
mov    $0x3,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x4(%rbx),%ecx
mov    %r14,%rdi
mov    $0x4,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x5(%rbx),%ecx
mov    %r14,%rdi
mov    $0x5,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"in f1:\0A\00"
@.str.1 = [66 x i8] c"at step %d * s1 = \22%c\22 in char; %d in digital and %p as pointer;\0A\00"
@.str.2 = [12 x i8] c"end of f1.\0A\00"
define void @f1(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, 5
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 ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [66 x i8] c"at step %d * s1 = \22%c\22 in char; %d in digital and %p as pointer;\0A\00"
@str = [7 x i8] c"in f1:\00"
@str.3 = [11 x i8] c"end of f1.\00"
define void @f1(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 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.3, i64 0, i64 0))
ret void
}