#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*/ RGBtoHSV(float, float, float, float *, float *, float *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  float r, g, b, h, s, v;
  if (argc < 4) {
    printf("need rgb vals\n");
    exit(0);
  }
  r = (float)strtol((argv[1]), NULL, 10) / (float)255;
  g = (float)strtol((argv[2]), NULL, 10) / (float)255;
  b = (float)strtol((argv[3]), NULL, 10) / (float)255;
  RGBtoHSV(r, g, b, &h, &s, &v);
  printf("h=%3.6f s=%3.6f v=%3.6f", h, s, v);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1175 <main+0x35>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
cvtsi2ss %rax,%xmm0
movss  0xe68(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
cvtsi2ss %rax,%xmm0
movss  0xe3c(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
cvtsi2ss %rax,%xmm0
movss  0xe10(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
lea    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <RGBtoHSV@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x28(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xdd8(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
cmp    $0x3,%edi
jg     116d <main+0x1d>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
cvtsi2ss %rax,%xmm0
divss  0xe73(%rip),%xmm0
movss  %xmm0,0x10(%rsp)
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
divss  0xe4d(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
mov    0x18(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
cvtsi2ss %rax,%xmm2
divss  0xe2a(%rip),%xmm2
lea    0x1c(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x14(%rsp),%rdx
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1050 <RGBtoHSV@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x18(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x14(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xde9(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"need rgb vals\0A\00"
@.str.1 = [24 x i8] c"h=%3.6f s=%3.6f v=%3.6f\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strtol(i8* %20, i32* null, i32 10)
%22 = sitofp i64 %21 to float
%23 = fdiv float %22, 2.550000e+02
store float %23, float* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i64 @strtol(i8* %26, i32* null, i32 10)
%28 = sitofp i64 %27 to float
%29 = fdiv float %28, 2.550000e+02
store float %29, float* %7
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 3
%32 = load i8*, i8** %31
%33 = call i64 @strtol(i8* %32, i32* null, i32 10)
%34 = sitofp i64 %33 to float
%35 = fdiv float %34, 2.550000e+02
store float %35, float* %8
%36 = load float, float* %6
%37 = load float, float* %7
%38 = load float, float* %8
%39 = call i32 @RGBtoHSV(float %36, float %37, float %38, float* %9, float* %10, float* %11)
%40 = load float, float* %9
%41 = fpext float %40 to double
%42 = load float, float* %10
%43 = fpext float %42 to double
%44 = load float, float* %11
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %41, double %43, double %45)
%47 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"h=%3.6f s=%3.6f v=%3.6f\00"
@str = [14 x i8] c"need rgb vals\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = bitcast float* %5 to i8*
%9 = icmp slt i32 %0, 4
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i64 @strtol(i8* nocapture %15, i32* null, i32 10)
%17 = sitofp i64 %16 to float
%18 = fdiv float %17, 2.550000e+02
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i64 @strtol(i8* nocapture %20, i32* null, i32 10)
%22 = sitofp i64 %21 to float
%23 = fdiv float %22, 2.550000e+02
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = tail call i64 @strtol(i8* nocapture %25, i32* null, i32 10)
%27 = sitofp i64 %26 to float
%28 = fdiv float %27, 2.550000e+02
%29 = call i32 @RGBtoHSV(float %18, float %23, float %28, float* %3, float* %4, float* %5)
%30 = load float, float* %3
%31 = fpext float %30 to double
%32 = load float, float* %4
%33 = fpext float %32 to double
%34 = load float, float* %5
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), double %31, double %33, double %35)
%37 = call i32 @exit(i32 0)
unreachable
}