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

/* Variables and functions */
int ConvertToDACValue(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
void fprintfChannel(FILE *pFile, int16_t *array, uint32_t size) {
  for (uint32_t i = 0; i < size; ++i) {
    fprintf(pFile, "%d, // %d\n", ConvertToDACValue(array[i]), array[i]);
  }
}


x86 assembly (clang, -O0):
<fprintfChannel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1190 <fprintfChannel+0x70>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <ConvertToDACValue@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe86(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113c <fprintfChannel+0x1c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprintfChannel>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rdx,%rdx
je     1165 <fprintfChannel+0x45>
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0xec0(%rip),%r12
mov    0x0(%r13,%rbx,4),%edi
call   1030 <ConvertToDACValue@plt>
mov    0x0(%r13,%rbx,4),%ecx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <fprintfChannel+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"%d, // %d\0A\00"
define void @fprintfChannel(i32* nocapture %0, i32* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %3
ret void
6: ; preds = %3, %6
%7 = phi i64 [ %13, %6 ], [ 0, %3 ]
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @ConvertToDACValue(i32 %9)
%11 = load i32, i32* %8
%12 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
%13 = add nuw i64 %7, 1
%14 = icmp eq i64 %13, %2
br i1 %14, label %5, label %6
}