#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 *, ...);
void DisplayPatch(float *Patch, int size) {
  int i, j, k;
  int Psize = 2 * size + 1;
  printf("Patch : \n ");
  for (k = 0; k < Psize; k++) {
    for (i = 0; i < Psize; i++) {
      for (j = 0; j < Psize; j++) {
        printf("%f ", Patch[k * (Psize * Psize) + (i * Psize) + j]);
      }
      printf("\n ");
    }
    printf("\n ");
  }
  printf("\n ");
}


x86 assembly (clang, -O0):
<DisplayPatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11ef <DisplayPatch+0xdf>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d3 <DisplayPatch+0xc3>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b7 <DisplayPatch+0xa7>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x1c(%rbp),%edx
imul   %edx,%ecx
mov    -0x10(%rbp),%edx
imul   -0x1c(%rbp),%edx
add    %edx,%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe69(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1166 <DisplayPatch+0x56>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1153 <DisplayPatch+0x43>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1140 <DisplayPatch+0x30>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisplayPatch>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    (%rsi,%rsi,1),%ebp
add    $0x1,%ebp
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,(%rsp)
test   %ebp,%ebp
jle    11e0 <DisplayPatch+0xd0>
mov    (%rsp),%eax
mov    %eax,%ecx
mov    %rcx,0x10(%rsp)
imul   %eax,%eax
mov    %eax,0x4(%rsp)
lea    0xeb3(%rip),%r14
xor    %r15d,%r15d
xor    %eax,%eax
nopl   (%rax)
mov    %eax,0x8(%rsp)
xor    %r13d,%r13d
mov    %r15d,0xc(%rsp)
nopl   0x0(%rax)
mov    0x10(%rsp),%r12
mov    %r15d,%ebp
nopl   0x0(%rax,%rax,1)
movslq %ebp,%rbp
movss  (%rbx,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x1,%ebp
add    $0xffffffffffffffff,%r12
jne    1180 <DisplayPatch+0x70>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r13d
mov    (%rsp),%eax
add    %eax,%r15d
cmp    %eax,%r13d
jne    1170 <DisplayPatch+0x60>
lea    0xe45(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%eax
add    $0x1,%eax
mov    0xc(%rsp),%r15d
add    0x4(%rsp),%r15d
cmp    (%rsp),%eax
jne    1160 <DisplayPatch+0x50>
lea    0xe21(%rip),%rdi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Patch : \0A \00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [3 x i8] c"\0A \00"
define void @DisplayPatch(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = mul nsw i32 2, %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %13
13: ; preds = %55, %2
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %58
17: ; preds = %13
store i32 0, i32* %5
br label %18
18: ; preds = %50, %17
%19 = load i32, i32* %5
%20 = load i32, i32* %8
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %53
22: ; preds = %18
store i32 0, i32* %6
br label %23
23: ; preds = %45, %22
%24 = load i32, i32* %6
%25 = load i32, i32* %8
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %48
27: ; preds = %23
%28 = load float*, float** %3
%29 = load i32, i32* %7
%30 = load i32, i32* %8
%31 = load i32, i32* %8
%32 = mul nsw i32 %30, %31
%33 = mul nsw i32 %29, %32
%34 = load i32, i32* %5
%35 = load i32, i32* %8
%36 = mul nsw i32 %34, %35
%37 = add nsw i32 %33, %36
%38 = load i32, i32* %6
%39 = add nsw i32 %37, %38
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %28, i64 %40
%42 = load float, float* %41
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %43)
br label %45
45: ; preds = %27
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %23
48: ; preds = %23
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %48
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %18
53: ; preds = %18
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %55
55: ; preds = %53
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %13
58: ; preds = %13
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Patch : \0A \00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [3 x i8] c"\0A \00"
define void @DisplayPatch(float* nocapture %0, i32 %1) {
%3 = shl nsw i32 %1, 1
%4 = or i32 %3, 1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %35
7: ; preds = %2
%8 = zext i32 %4 to i64
br label %9
9: ; preds = %31, %7
%10 = phi i32 [ 0, %7 ], [ %33, %31 ]
%11 = mul i32 %10, %4
br label %12
12: ; preds = %27, %9
%13 = phi i32 [ 0, %9 ], [ %29, %27 ]
%14 = add i32 %13, %11
%15 = mul i32 %14, %4
br label %16
16: ; preds = %12, %16
%17 = phi i64 [ 0, %12 ], [ %25, %16 ]
%18 = trunc i64 %17 to i32
%19 = add i32 %15, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* %0, i64 %20
%22 = load float, float* %21
%23 = fpext float %22 to double
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %23)
%25 = add nuw nsw i64 %17, 1
%26 = icmp eq i64 %25, %8
br i1 %26, label %27, label %16
27: ; preds = %16
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%29 = add nuw nsw i32 %13, 1
%30 = icmp eq i32 %29, %4
br i1 %30, label %31, label %12
31: ; preds = %27
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%33 = add nuw nsw i32 %10, 1
%34 = icmp eq i32 %33, %4
br i1 %34, label %35, label %9
35: ; preds = %31, %2
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}