#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 vrna_bpp_symbol(float const *);
void print_bppm(const float *T) {
  int i;
  for (i = 1; i <= ((int)T[0]); i++)
    printf("%c", vrna_bpp_symbol(T + i * 3));
  printf("\n");
}


x86 assembly (clang, -O0):
<print_bppm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
cvttss2si (%rcx),%ecx
cmp    %ecx,%eax
jg     117a <print_bppm+0x5a>
mov    -0x8(%rbp),%rdi
imul   $0x3,-0xc(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <vrna_bpp_symbol@plt>
mov    %eax,%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <print_bppm+0x13>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bppm>:
push   %r15
push   %r14
push   %rbx
cvttss2si (%rdi),%eax
test   %eax,%eax
jle    1163 <print_bppm+0x43>
mov    %rdi,%r14
lea    0xc(%rdi),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <vrna_bpp_symbol@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
cvttss2si (%r14),%eax
cltq
add    $0x1,%rbx
add    $0xc,%r15
cmp    %rax,%rbx
jl     1140 <print_bppm+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print_bppm(float* %0) {
%2 = load float, float* %0
%3 = fptosi float %2 to i32
%4 = icmp slt i32 %3, 1
br i1 %4, label %16, label %5
5: ; preds = %1, %5
%6 = phi i64 [ %11, %5 ], [ 1, %1 ]
%7 = mul nuw nsw i64 %6, 3
%8 = getelementptr inbounds float, float* %0, i64 %7
%9 = tail call i32 @vrna_bpp_symbol(float* %8)
%10 = tail call i32 @putchar(i32 %9)
%11 = add nuw nsw i64 %6, 1
%12 = load float, float* %0
%13 = fptosi float %12 to i32
%14 = sext i32 %13 to i64
%15 = icmp slt i64 %6, %14
br i1 %15, label %5, label %16
16: ; preds = %5, %1
%17 = tail call i32 @putchar(i32 10)
ret void
}