#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*/ compose_row(float *);
int /*<<< orphan*/ free(float *);
scalar_t__ malloc(int);
int /*<<< orphan*/ transpose_image(float *, float *);
void compose_image(float *image) {
  int row;
  float *transposed_image = (float *)malloc(sizeof(float) * 3 * 64 * 64);
  transpose_image(image, transposed_image);
  for (row = 0; row < 64; ++row)
    compose_row(transposed_image + 3 * 64 * row);
  transpose_image(transposed_image, image);
  for (row = 0; row < 64; ++row)
    compose_row(image + 3 * 64 * row);
  free(transposed_image);
}


x86 assembly (clang, -O0):
<compose_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xc000,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <transpose_image@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    119f <compose_image+0x5f>
mov    -0x18(%rbp),%rdi
imul   $0xc0,-0xc(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <compose_row@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116e <compose_image+0x2e>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <transpose_image@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    11e4 <compose_image+0xa4>
mov    -0x8(%rbp),%rdi
imul   $0xc0,-0xc(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <compose_row@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b3 <compose_image+0x73>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compose_image>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0xc000,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <transpose_image@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rdi
call   1040 <compose_row@plt>
add    $0x300,%rbx
cmp    $0xc000,%rbx
jne    1170 <compose_image+0x30>
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <transpose_image@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
lea    (%r14,%rbx,1),%rdi
call   1040 <compose_row@plt>
add    $0x300,%rbx
cmp    $0xc000,%rbx
jne    11a0 <compose_image+0x60>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @compose_image(float* %0) {
%2 = alloca float*
%3 = alloca i32
%4 = alloca float*
store float* %0, float** %2
%5 = call i64 @malloc(i32 49152)
%6 = inttoptr i64 %5 to float*
store float* %6, float** %4
%7 = load float*, float** %2
%8 = load float*, float** %4
%9 = call i32 @transpose_image(float* %7, float* %8)
store i32 0, i32* %3
br label %10
10: ; preds = %20, %1
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 64
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = load float*, float** %4
%15 = load i32, i32* %3
%16 = mul nsw i32 192, %15
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds float, float* %14, i64 %17
%19 = call i32 @compose_row(float* %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %10
23: ; preds = %10
%24 = load float*, float** %4
%25 = load float*, float** %2
%26 = call i32 @transpose_image(float* %24, float* %25)
store i32 0, i32* %3
br label %27
27: ; preds = %37, %23
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 64
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = load float*, float** %2
%32 = load i32, i32* %3
%33 = mul nsw i32 192, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float, float* %31, i64 %34
%36 = call i32 @compose_row(float* %35)
br label %37
37: ; preds = %30
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %27
40: ; preds = %27
%41 = load float*, float** %4
%42 = call i32 @free(float* %41)
ret void
}

LLVM IR (-O2):
define void @compose_image(float* %0) {
%2 = tail call i64 @malloc(i32 49152)
%3 = inttoptr i64 %2 to float*
%4 = tail call i32 @transpose_image(float* %0, float* %3)
br label %5
5: ; preds = %1, %5
%6 = phi i64 [ 0, %1 ], [ %10, %5 ]
%7 = mul nuw nsw i64 %6, 192
%8 = getelementptr inbounds float, float* %3, i64 %7
%9 = tail call i32 @compose_row(float* %8)
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 64
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = tail call i32 @transpose_image(float* %3, float* %0)
br label %14
14: ; preds = %12, %14
%15 = phi i64 [ 0, %12 ], [ %19, %14 ]
%16 = mul nuw nsw i64 %15, 192
%17 = getelementptr inbounds float, float* %0, i64 %16
%18 = tail call i32 @compose_row(float* %17)
%19 = add nuw nsw i64 %15, 1
%20 = icmp eq i64 %19, 64
br i1 %20, label %21, label %14
21: ; preds = %14
%22 = tail call i32 @free(float* %3)
ret void
}