#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);
int _processStream(char *byteStream, int length, int depth) {
  printf("At depth %d\n", depth);
  if (length != depth) {
    byteStream[depth]++;
    _processStream(byteStream, length, depth + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<_processStream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1170 <_processStream+0x50>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
add    $0x1,%dl
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
call   1040 <_processStream@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_processStream>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xed8(%rip),%rdi
mov    %edx,%esi
call   1030 <printf@plt>
cmp    %r15d,%r14d
je     1177 <_processStream+0x67>
movslq %r15d,%rax
add    %rax,%rbx
neg    %r14d
add    $0x1,%r15d
lea    0xeb8(%rip),%r12
nopl   0x0(%rax,%rax,1)
addb   $0x1,(%rbx)
mov    %r12,%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
lea    (%r14,%r15,1),%eax
add    $0x1,%eax
mov    %r15d,%ecx
add    $0x1,%ecx
mov    %ecx,%r15d
cmp    $0x1,%eax
jne    1150 <_processStream+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"At depth %d\0A\00"
define i32 @_processStream(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %24
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = add i8 %17, 1
store i8 %18, i8* %16
%19 = load i8*, i8** %4
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
%23 = call i32 @_processStream(i8* %19, i32 %20, i32 %22)
br label %24
24: ; preds = %12, %3
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"At depth %d\0A\00"
define i32 @_processStream(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = icmp eq i32 %1, %2
br i1 %5, label %17, label %6
6: ; preds = %3
%7 = sext i32 %2 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ %7, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = add i8 %11, 1
store i8 %12, i8* %10
%13 = add nsw i64 %9, 1
%14 = trunc i64 %13 to i32
%15 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = icmp eq i32 %14, %1
br i1 %16, label %17, label %8
17: ; preds = %8, %3
ret i32 0
}