#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*/ print_blob(int, int);
int /*<<< orphan*/ printf(char *, int);
int track_count(int);
void print_channel(int channel, int max_blobs) {
  int blob;
  printf("Channel %d:\n", channel);
  for (blob = 0; blob < max_blobs && blob < track_count(channel); blob++) {
    print_blob(channel, blob);
  }
}


x86 assembly (clang, -O0):
<print_channel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0xd(%rbp)
jge    1180 <print_channel+0x50>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <track_count@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1190 <print_channel+0x60>
jmp    11a9 <print_channel+0x79>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <print_blob@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <print_channel+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_channel>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
lea    0xec0(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
test   %r14d,%r14d
jle    116c <print_channel+0x3c>
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %ebp,%edi
call   1050 <track_count@plt>
cmp    %eax,%ebx
jge    116c <print_channel+0x3c>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <print_blob@plt>
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1150 <print_channel+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"Channel %d:\0A\00"
define void @print_channel(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %13
5: ; preds = %2, %9
%6 = phi i32 [ %11, %9 ], [ 0, %2 ]
%7 = tail call i32 @track_count(i32 %0)
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = tail call i32 @print_blob(i32 %0, i32 %6)
%11 = add nuw nsw i32 %6, 1
%12 = icmp eq i32 %11, %1
br i1 %12, label %13, label %5
13: ; preds = %5, %9, %2
ret void
}