#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
size_t glbGetNumberOfChannels(int);
int /*<<< orphan*/ glbPrintDelimiter(int /*<<< orphan*/ *, char);
char *glbValueToName(int, char *, size_t);
void channel_name(FILE *stream, int exp, int number, int spec) {
  size_t c, i;
  c = glbGetNumberOfChannels(exp);
  if (spec != 1)
    fprintf(stream, "\n      \t");
  else
    fprintf(stream, "\n          \t");
  for (i = 0; i < c; i++) {
    if (number != -1)
      i = number;
    fprintf(stream, "%s\t", glbValueToName(exp, "channel", i));
    glbPrintDelimiter(stream, 'm');
    if (number != -1)
      break;
  }
  fprintf(stream, "\n");
  return;
}


x86 assembly (clang, -O0):
<channel_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <glbGetNumberOfChannels@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     1182 <channel_name+0x42>
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1194 <channel_name+0x54>
mov    -0x8(%rbp),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    121f <channel_name+0xdf>
cmpl   $0xffffffff,-0x10(%rbp)
je     11bc <channel_name+0x7c>
movslq -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x28(%rbp),%rdx
lea    0xe48(%rip),%rsi
call   1060 <glbValueToName@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rdx
lea    0xe31(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x6d,%esi
call   1050 <glbPrintDelimiter@plt>
cmpl   $0xffffffff,-0x10(%rbp)
je     1209 <channel_name+0xc9>
jmp    121f <channel_name+0xdf>
jmp    120e <channel_name+0xce>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    119c <channel_name+0x5c>
mov    -0x8(%rbp),%rdi
lea    0xdf8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<channel_name>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <glbGetNumberOfChannels@plt>
mov    %rax,%r13
cmp    $0x1,%ebp
jne    1193 <channel_name+0x33>
lea    0xe7d(%rip),%rdi
mov    $0xc,%esi
jmp    119f <channel_name+0x3f>
lea    0xe66(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
test   %r13,%r13
je     1206 <channel_name+0xa6>
movslq %r15d,%r15
lea    0xe5b(%rip),%r12
xor    %ebp,%ebp
nopl   (%rax)
cmp    $0xffffffff,%r15d
cmovne %r15,%rbp
mov    %r14d,%edi
lea    0xe48(%rip),%rsi
mov    %rbp,%rdx
call   1070 <glbValueToName@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x6d,%esi
call   1060 <glbPrintDelimiter@plt>
cmp    $0xffffffff,%r15d
jne    1206 <channel_name+0xa6>
add    $0x1,%rbp
cmp    %r13,%rbp
jb     11c0 <channel_name+0x60>
mov    $0xa,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fputc@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"\0A \09\00"
@.str.1 = [13 x i8] c"\0A \09\00"
@.str.2 = [4 x i8] c"%s\09\00"
@.str.3 = [8 x i8] c"channel\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @channel_name(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %6
%12 = call i64 @glbGetNumberOfChannels(i32 %11)
store i64 %12, i64* %9
%13 = load i32, i32* %8
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i32*, i32** %5
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %21
18: ; preds = %4
%19 = load i32*, i32** %5
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %18, %15
store i64 0, i64* %10
br label %22
22: ; preds = %44, %21
%23 = load i64, i64* %10
%24 = load i64, i64* %9
%25 = icmp ult i64 %23, %24
br i1 %25, label %26, label %47
26: ; preds = %22
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, -1
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
store i64 %31, i64* %10
br label %32
32: ; preds = %29, %26
%33 = load i32*, i32** %5
%34 = load i32, i32* %6
%35 = load i64, i64* %10
%36 = call i8* @glbValueToName(i32 %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i64 %35)
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = load i32*, i32** %5
%39 = call i32 @glbPrintDelimiter(i32* %38, i8 signext 109)
%40 = load i32, i32* %7
%41 = icmp ne i32 %40, -1
br i1 %41, label %42, label %43
42: ; preds = %32
br label %47
43: ; preds = %32
br label %44
44: ; preds = %43
%45 = load i64, i64* %10
%46 = add i64 %45, 1
store i64 %46, i64* %10
br label %22
47: ; preds = %42, %22
%48 = load i32*, i32** %5
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"\0A \09\00"
@.str.1 = [13 x i8] c"\0A \09\00"
@.str.2 = [4 x i8] c"%s\09\00"
@.str.3 = [8 x i8] c"channel\00"
define void @channel_name(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i64 @glbGetNumberOfChannels(i32 %1)
%6 = icmp eq i32 %3, 1
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 8, i64 1, i32* %0)
br label %11
9: ; preds = %4
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 12, i64 1, i32* %0)
br label %11
11: ; preds = %9, %7
%12 = sext i32 %2 to i64
%13 = icmp eq i32 %2, -1
%14 = icmp eq i64 %5, 0
br i1 %14, label %24, label %15
15: ; preds = %11, %15
%16 = phi i64 [ %21, %15 ], [ 0, %11 ]
%17 = select i1 %13, i64 %16, i64 %12
%18 = tail call i8* @glbValueToName(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i64 %17)
%19 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = tail call i32 @glbPrintDelimiter(i32* %0, i8 signext 109)
%21 = add i64 %17, 1
%22 = icmp ult i64 %21, %5
%23 = select i1 %13, i1 %22, i1 false
br i1 %23, label %15, label %24
24: ; preds = %15, %11
%25 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}