#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*/ free(double *);
int /*<<< orphan*/ linear_conversion(double *, double *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printImage(double *, int, int, char *);
void printImage_LinearConversion(double *imageIn, int w, int h, char *name) {
  double *imTemp = (double *)malloc(w * h * sizeof(double));
  linear_conversion(imageIn, imTemp, w * h);
  linear_conversion(imageIn, imTemp, w * h);
  printImage(imTemp, w, h, name);
  free(imTemp);
}


x86 assembly (clang, -O0):
<printImage_LinearConversion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
imul   -0x10(%rbp),%edx
call   1050 <linear_conversion@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
imul   -0x10(%rbp),%edx
call   1050 <linear_conversion@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1060 <printImage@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printImage_LinearConversion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%r13
mov    %edx,%ebx
imul   %esi,%ebx
lea    0x0(,%rbx,8),%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
mov    %r13,%rdi
mov    %rax,%rsi
mov    %ebx,%edx
call   1050 <linear_conversion@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1050 <linear_conversion@plt>
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14,%rcx
call   1060 <printImage@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @printImage_LinearConversion(double* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca double*
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = mul nsw i32 %10, %11
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 8
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to double*
store double* %17, double** %9
%18 = load double*, double** %5
%19 = load double*, double** %9
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = mul nsw i32 %20, %21
%23 = call i32 @linear_conversion(double* %18, double* %19, i32 %22)
%24 = load double*, double** %5
%25 = load double*, double** %9
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = mul nsw i32 %26, %27
%29 = call i32 @linear_conversion(double* %24, double* %25, i32 %28)
%30 = load double*, double** %9
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = load i8*, i8** %8
%34 = call i32 @printImage(double* %30, i32 %31, i32 %32, i8* %33)
%35 = load double*, double** %9
%36 = call i32 @free(double* %35)
ret void
}

LLVM IR (-O2):
define void @printImage_LinearConversion(double* %0, i32 %1, i32 %2, i8* %3) {
%5 = mul nsw i32 %2, %1
%6 = shl i32 %5, 3
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to double*
%9 = tail call i32 @linear_conversion(double* %0, double* %8, i32 %5)
%10 = tail call i32 @linear_conversion(double* %0, double* %8, i32 %5)
%11 = tail call i32 @printImage(double* %8, i32 %1, i32 %2, i8* %3)
%12 = tail call i32 @free(double* %8)
ret void
}