#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*/ hsv2rgb(int, int, int, unsigned char *, unsigned char *,
                           unsigned char *);
int /*<<< orphan*/ printf(char *, int, int, int);
void main(void) {
  int i;
  for (i = 0; i < 512; i++) {
    unsigned char r, g, b;
    hsv2rgb(i, 255, 255, &r, &g, &b);
    printf("%d %d %d\n", (int)r, (int)g, (int)b);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x200,-0x4(%rbp)
jge    117d <main+0x5d>
mov    -0x4(%rbp),%edi
mov    $0xff,%edx
lea    -0x5(%rbp),%rcx
lea    -0x6(%rbp),%r8
lea    -0x7(%rbp),%r9
mov    %edx,%esi
call   1030 <hsv2rgb@plt>
movzbl -0x5(%rbp),%esi
movzbl -0x6(%rbp),%edx
movzbl -0x7(%rbp),%ecx
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
lea    0xf(%rsp),%r14
lea    0xe(%rsp),%r15
lea    0xd(%rsp),%r12
lea    0xebb(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    $0xff,%esi
mov    $0xff,%edx
mov    %r14,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   1030 <hsv2rgb@plt>
movzbl 0xf(%rsp),%esi
movzbl 0xe(%rsp),%edx
movzbl 0xd(%rsp),%ecx
mov    %r13,%rdi
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x200,%ebx
jne    1150 <main+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d\0A\00"
define void @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %14, %4 ]
%6 = call i32 @hsv2rgb(i32 %5, i32 255, i32 255, i8* %1, i8* %2, i8* %3)
%7 = load i8, i8* %1
%8 = zext i8 %7 to i32
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10, i32 %12)
%14 = add nuw nsw i32 %5, 1
%15 = icmp eq i32 %14, 512
br i1 %15, label %16, label %4
16: ; preds = %4
ret void
}