#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*/ aan_normalizar_canal_float(float *, float *, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(float *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(void *, void const *, int);
int /*<<< orphan*/ stderr;
void aan_normalizar_imagen_float(float *red, float *green, float *blue,
                                 int width, int height) {
  if (!red || !green || !blue) {
    fprintf(stderr, "Ninguno de los canales puede ser NULL");
    return;
  }
  if (width < 1 || height < 1) {
    fprintf(stderr, "La anchura y la altura del canal deben ser mayores que 0");
    return;
  }
  float *tmp = (float *)malloc(sizeof(float) * width * height);
  aan_normalizar_canal_float(red, tmp, width, height);
  memcpy((void *)red, (const void *)tmp, sizeof(float) * width * height);
  aan_normalizar_canal_float(green, tmp, width, height);
  memcpy((void *)green, (const void *)tmp, sizeof(float) * width * height);
  aan_normalizar_canal_float(blue, tmp, width, height);
  memcpy((void *)blue, (const void *)tmp, sizeof(float) * width * height);
  free(tmp);
}


x86 assembly (clang, -O0):
<aan_normalizar_imagen_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118c <aan_normalizar_imagen_float+0x3c>
cmpq   $0x0,-0x10(%rbp)
je     118c <aan_normalizar_imagen_float+0x3c>
cmpq   $0x0,-0x18(%rbp)
jne    11a6 <aan_normalizar_imagen_float+0x56>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
call   1050 <fprintf@plt>
jmp    128e <aan_normalizar_imagen_float+0x13e>
cmpl   $0x1,-0x1c(%rbp)
jl     11ba <aan_normalizar_imagen_float+0x6a>
cmpl   $0x1,-0x20(%rbp)
jge    11d4 <aan_normalizar_imagen_float+0x84>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
call   1050 <fprintf@plt>
jmp    128e <aan_normalizar_imagen_float+0x13e>
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1040 <aan_normalizar_canal_float@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1040 <aan_normalizar_canal_float@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1040 <aan_normalizar_canal_float@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
movslq -0x20(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aan_normalizar_imagen_float>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     121f <aan_normalizar_imagen_float+0xcf>
mov    %rsi,%rbp
test   %rsi,%rsi
je     121f <aan_normalizar_imagen_float+0xcf>
test   %rdx,%rdx
je     121f <aan_normalizar_imagen_float+0xcf>
mov    %ecx,%r12d
test   %ecx,%ecx
jle    1231 <aan_normalizar_imagen_float+0xe1>
mov    %r8d,%r15d
test   %r8d,%r8d
jle    1231 <aan_normalizar_imagen_float+0xe1>
mov    %rdi,%r14
mov    %r12d,%ebx
imul   %r15d,%ebx
shl    $0x2,%ebx
mov    %ebx,%edi
mov    %rdx,(%rsp)
call   1070 <malloc@plt>
mov    %rax,%r13
mov    %r14,%rdi
mov    %rax,%rsi
mov    %r12d,%edx
mov    %r15d,%ecx
call   1040 <aan_normalizar_canal_float@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1060 <memcpy@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r12d,%edx
mov    %r15d,%ecx
call   1040 <aan_normalizar_canal_float@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1060 <memcpy@plt>
mov    (%rsp),%rbp
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r12d,%edx
mov    %r15d,%ecx
call   1040 <aan_normalizar_canal_float@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1060 <memcpy@plt>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
lea    0xdd1(%rip),%rsi
jmp    1241 <aan_normalizar_imagen_float+0xf1>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
lea    0xde5(%rip),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"Ninguno de los canales puede ser NULL\00"
@.str.1 = [57 x i8] c"La anchura y la altura del canal deben ser mayores que 0\00"
define void @aan_normalizar_imagen_float(float* %0, float* %1, float* %2, i32 %3, i32 %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca i32
%10 = alloca i32
%11 = alloca float*
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load float*, float** %6
%13 = icmp ne float* %12, null
br i1 %13, label %14, label %20
14: ; preds = %5
%15 = load float*, float** %7
%16 = icmp ne float* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load float*, float** %8
%19 = icmp ne float* %18, null
br i1 %19, label %23, label %20
20: ; preds = %17, %14, %5
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %95
23: ; preds = %17
%24 = load i32, i32* %9
%25 = icmp slt i32 %24, 1
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %10
%28 = icmp slt i32 %27, 1
br i1 %28, label %29, label %32
29: ; preds = %26, %23
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
br label %95
32: ; preds = %26
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = mul i64 4, %34
%36 = load i32, i32* %10
%37 = sext i32 %36 to i64
%38 = mul i64 %35, %37
%39 = trunc i64 %38 to i32
%40 = call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to float*
store float* %41, float** %11
%42 = load float*, float** %6
%43 = load float*, float** %11
%44 = load i32, i32* %9
%45 = load i32, i32* %10
%46 = call i32 @aan_normalizar_canal_float(float* %42, float* %43, i32 %44, i32 %45)
%47 = load float*, float** %6
%48 = bitcast float* %47 to i8*
%49 = load float*, float** %11
%50 = bitcast float* %49 to i8*
%51 = load i32, i32* %9
%52 = sext i32 %51 to i64
%53 = mul i64 4, %52
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = mul i64 %53, %55
%57 = trunc i64 %56 to i32
%58 = call i32 @memcpy(i8* %48, i8* %50, i32 %57)
%59 = load float*, float** %7
%60 = load float*, float** %11
%61 = load i32, i32* %9
%62 = load i32, i32* %10
%63 = call i32 @aan_normalizar_canal_float(float* %59, float* %60, i32 %61, i32 %62)
%64 = load float*, float** %7
%65 = bitcast float* %64 to i8*
%66 = load float*, float** %11
%67 = bitcast float* %66 to i8*
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = mul i64 4, %69
%71 = load i32, i32* %10
%72 = sext i32 %71 to i64
%73 = mul i64 %70, %72
%74 = trunc i64 %73 to i32
%75 = call i32 @memcpy(i8* %65, i8* %67, i32 %74)
%76 = load float*, float** %8
%77 = load float*, float** %11
%78 = load i32, i32* %9
%79 = load i32, i32* %10
%80 = call i32 @aan_normalizar_canal_float(float* %76, float* %77, i32 %78, i32 %79)
%81 = load float*, float** %8
%82 = bitcast float* %81 to i8*
%83 = load float*, float** %11
%84 = bitcast float* %83 to i8*
%85 = load i32, i32* %9
%86 = sext i32 %85 to i64
%87 = mul i64 4, %86
%88 = load i32, i32* %10
%89 = sext i32 %88 to i64
%90 = mul i64 %87, %89
%91 = trunc i64 %90 to i32
%92 = call i32 @memcpy(i8* %82, i8* %84, i32 %91)
%93 = load float*, float** %11
%94 = call i32 @free(float* %93)
br label %95
95: ; preds = %32, %29, %20
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"Ninguno de los canales puede ser NULL\00"
@.str.1 = [57 x i8] c"La anchura y la altura del canal deben ser mayores que 0\00"
define void @aan_normalizar_imagen_float(float* %0, float* %1, float* %2, i32 %3, i32 %4) {
%6 = icmp ne float* %0, null
%7 = icmp ne float* %1, null
%8 = and i1 %6, %7
%9 = icmp ne float* %2, null
%10 = and i1 %8, %9
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %37
14: ; preds = %5
%15 = icmp slt i32 %3, 1
%16 = icmp slt i32 %4, 1
%17 = or i1 %15, %16
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
br label %37
21: ; preds = %14
%22 = shl i32 %3, 2
%23 = mul i32 %22, %4
%24 = tail call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to float*
%26 = tail call i32 @aan_normalizar_canal_float(float* %0, float* %25, i32 %3, i32 %4)
%27 = bitcast float* %0 to i8*
%28 = inttoptr i64 %24 to i8*
%29 = tail call i32 @memcpy(i8* %27, i8* %28, i32 %23)
%30 = tail call i32 @aan_normalizar_canal_float(float* %1, float* %25, i32 %3, i32 %4)
%31 = bitcast float* %1 to i8*
%32 = tail call i32 @memcpy(i8* %31, i8* %28, i32 %23)
%33 = tail call i32 @aan_normalizar_canal_float(float* %2, float* %25, i32 %3, i32 %4)
%34 = bitcast float* %2 to i8*
%35 = tail call i32 @memcpy(i8* %34, i8* %28, i32 %23)
%36 = tail call i32 @free(float* %25)
br label %37
37: ; preds = %21, %18, %11
ret void
}