#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, char, char, char);
int strlen_my(char *string) {
  int i = 0;
  while (*string != '\0') {
    printf("at step %d * string = %c in char, %d in digit and %p as point;\n",
           i, *string, *string, *string);
    i++;
    *string++;
  };
  return i;
}


x86 assembly (clang, -O0):
<strlen_my>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1176 <strlen_my+0x66>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    (%rax),%dl
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
lea    0xeb3(%rip),%rdi
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl (%rax),%r8d
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1123 <strlen_my+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen_my>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1152 <strlen_my+0x42>
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed9(%rip),%r15
nopw   0x0(%rax,%rax,1)
movsbl %al,%ecx
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
call   1030 <printf@plt>
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strlen_my+0x20>
jmp    1154 <strlen_my+0x44>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [64 x i8] c"at step %d * string = %c in char, %d in digit and %p as point;\0A\00"
define i32 @strlen_my(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %23
9: ; preds = %4
%10 = load i32, i32* %3
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %10, i8 signext %12, i8 signext %14, i8 signext %16)
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
%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 %4
23: ; preds = %4
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [64 x i8] c"at step %d * string = %c in char, %d in digit and %p as point;\0A\00"
define i32 @strlen_my(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %9, %4 ], [ 0, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %6, i8 signext %5, i8 signext %5, i8 signext %5)
%9 = add nuw nsw i32 %6, 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = phi i32 [ 0, %1 ], [ %9, %4 ]
ret i32 %14
}