#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 /*<<< orphan*/ rgb2yuv(double *, double *, double *, double, double,
                           double);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ yuv2rgb(double *, double *, double *, double, double,
                           double);
void conversion() {
  int choix;
  double r, g, b, y, u, v;
  printf("Conversion rgb->Yuv 1;Yuv->rgb 2\nChoix ?=(1 ou 2)");
  scanf("%d", &choix);
  printf("\n");
  if (choix == 1) {
    printf("Entrez les valeurs r,g,b\n");
    scanf("%lf %lf %lf", &r, &g, &b);
    printf("\n");
    rgb2yuv(&y, &u, &v, r, g, b);
    printf("r=%lf g=%lf b=%lf -> Y=%lf u=%lf v=%lf\n", r, g, b, y, u, v);
  } else {
    printf("Entrez les valeurs Y,u,v\n");
    scanf("%lf %lf %lf", &y, &u, &v);
    printf("\n");
    yuv2rgb(&r, &g, &b, y, u, v);
    printf("Y=%lf u=%lf v=%lf -> r=%lf g=%lf b=%lf\n", y, u, v, r, g, b);
  }
}


x86 assembly (clang, -O0):
<conversion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1207 <conversion+0xc7>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1040 <rgb2yuv@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
lea    0xe60(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
jmp    1289 <conversion+0x149>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe33(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <yuv2rgb@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm5
lea    0xe1b(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conversion>:
sub    $0x38,%rsp
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0x34(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x1,0x34(%rsp)
jne    1220 <conversion+0xc0>
lea    0xf09(%rip),%rdi
call   1040 <puts@plt>
lea    0xe88(%rip),%rdi
lea    0x28(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x18(%rsp),%rcx
xor    %eax,%eax
call   1080 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <rgb2yuv@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x10(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  (%rsp),%xmm5
lea    0xe26(%rip),%rdi
jmp    12a0 <conversion+0x140>
lea    0xe6a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe02(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
xor    %eax,%eax
call   1080 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
call   1070 <yuv2rgb@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x18(%rsp),%xmm5
lea    0xdc9(%rip),%rdi
mov    $0x6,%al
call   1050 <printf@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Conversion rgb->Yuv 1;Yuv->rgb 2\0AChoix ?=(1 ou 2)\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [26 x i8] c"Entrez les valeurs r,g,b\0A\00"
@.str.4 = [12 x i8] c"%lf %lf %lf\00"
@.str.5 = [40 x i8] c"r=%lf g=%lf b=%lf -> Y=%lf u=%lf v=%lf\0A\00"
@.str.6 = [26 x i8] c"Entrez les valeurs Y,u,v\0A\00"
@.str.7 = [40 x i8] c"Y=%lf u=%lf v=%lf -> r=%lf g=%lf b=%lf\0A\00"
define void @conversion() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %28
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double* %2, double* %3, double* %4)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = load double, double* %2
%18 = load double, double* %3
%19 = load double, double* %4
%20 = call i32 @rgb2yuv(double* %5, double* %6, double* %7, double %17, double %18, double %19)
%21 = load double, double* %2
%22 = load double, double* %3
%23 = load double, double* %4
%24 = load double, double* %5
%25 = load double, double* %6
%26 = load double, double* %7
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %21, double %22, double %23, double %24, double %25, double %26)
br label %43
28: ; preds = %0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double* %5, double* %6, double* %7)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%32 = load double, double* %5
%33 = load double, double* %6
%34 = load double, double* %7
%35 = call i32 @yuv2rgb(double* %2, double* %3, double* %4, double %32, double %33, double %34)
%36 = load double, double* %5
%37 = load double, double* %6
%38 = load double, double* %7
%39 = load double, double* %2
%40 = load double, double* %3
%41 = load double, double* %4
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), double %36, double %37, double %38, double %39, double %40, double %41)
br label %43
43: ; preds = %28, %13
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"Conversion rgb->Yuv 1;Yuv->rgb 2\0AChoix ?=(1 ou 2)\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [12 x i8] c"%lf %lf %lf\00"
@.str.5 = [40 x i8] c"r=%lf g=%lf b=%lf -> Y=%lf u=%lf v=%lf\0A\00"
@.str.7 = [40 x i8] c"Y=%lf u=%lf v=%lf -> r=%lf g=%lf b=%lf\0A\00"
@str = [25 x i8] c"Entrez les valeurs Y,u,v\00"
@str.8 = [25 x i8] c"Entrez les valeurs r,g,b\00"
define void @conversion() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = bitcast i32* %1 to i8*
%9 = bitcast double* %2 to i8*
%10 = bitcast double* %3 to i8*
%11 = bitcast double* %4 to i8*
%12 = bitcast double* %5 to i8*
%13 = bitcast double* %6 to i8*
%14 = bitcast double* %7 to i8*
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%17 = call i32 @putchar(i32 10)
%18 = load i32, i32* %1
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %35
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double* %2, double* %3, double* %4)
%23 = call i32 @putchar(i32 10)
%24 = load double, double* %2
%25 = load double, double* %3
%26 = load double, double* %4
%27 = call i32 @rgb2yuv(double* %5, double* %6, double* %7, double %24, double %25, double %26)
%28 = load double, double* %2
%29 = load double, double* %3
%30 = load double, double* %4
%31 = load double, double* %5
%32 = load double, double* %6
%33 = load double, double* %7
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %28, double %29, double %30, double %31, double %32, double %33)
br label %50
35: ; preds = %0
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double* %5, double* %6, double* %7)
%38 = call i32 @putchar(i32 10)
%39 = load double, double* %5
%40 = load double, double* %6
%41 = load double, double* %7
%42 = call i32 @yuv2rgb(double* %2, double* %3, double* %4, double %39, double %40, double %41)
%43 = load double, double* %5
%44 = load double, double* %6
%45 = load double, double* %7
%46 = load double, double* %2
%47 = load double, double* %3
%48 = load double, double* %4
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), double %43, double %44, double %45, double %46, double %47, double %48)
br label %50
50: ; preds = %35, %20
ret void
}