#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 func2(int row, int col, double (*target)[col], double (*source)[col]) {
  int i, j;
  printf("source:\n");
  for (i = row; i > 0; i--) {
    for (j = col; j > 0; j--) {
      printf("%f\t", (*(source + i - 1))[j - 1]);
    }
    printf("\n");
  }
  printf("target:\n");
  for (i = row; i > 0; i--) {
    for (j = col; j > 0; j--) {
      printf("%f\t", (*(target + i - 1))[j - 1]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x28(%rbp)
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    11ca <func2+0xba>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    11ae <func2+0x9e>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rdx
imul   %rcx,%rdx
shl    $0x3,%rdx
add    %rdx,%rax
imul   $0xffffffffffffffff,%rcx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe70(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    1158 <func2+0x48>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <func2+0x38>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1260 <func2+0x150>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    1244 <func2+0x134>
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rdx
imul   %rcx,%rdx
shl    $0x3,%rdx
add    %rdx,%rax
imul   $0xffffffffffffffff,%rcx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdda(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    11ee <func2+0xde>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    11de <func2+0xce>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,%rbp
mov    %rdx,0x18(%rsp)
mov    %esi,%r15d
mov    %edi,%ebx
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
jle    129e <func2+0x16e>
mov    %r15d,%eax
mov    %ebx,0x14(%rsp)
mov    %ebx,%r12d
lea    0x0(,%rax,8),%rcx
mov    %rcx,0x20(%rsp)
sub    %rcx,%rbp
mov    %rbp,0x30(%rsp)
mov    %rax,0x8(%rsp)
add    $0x1,%rax
mov    %rax,0x28(%rsp)
lea    0xe6d(%rip),%rbx
mov    %r12,%r14
jmp    11b7 <func2+0x87>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%r14),%rax
cmp    $0x1,%r14
mov    %rax,%r14
jle    1200 <func2+0xd0>
test   %r15d,%r15d
jle    11a0 <func2+0x70>
mov    %r14,%rax
imul   0x8(%rsp),%rax
mov    0x30(%rsp),%rcx
lea    (%rcx,%rax,8),%r13
mov    0x28(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x2(%rbp),%eax
movsd  0x0(%r13,%rax,8),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbp
cmp    $0x1,%rbp
jg     11e0 <func2+0xb0>
jmp    11a0 <func2+0x70>
lea    0xe05(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x14(%rsp)
jle    128f <func2+0x15f>
mov    0x20(%rsp),%rax
sub    %rax,0x18(%rsp)
mov    0x8(%rsp),%rax
lea    0x1(%rax),%r14
lea    0xdd3(%rip),%r13
jmp    1248 <func2+0x118>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%r12),%rax
cmp    $0x1,%r12
mov    %rax,%r12
jle    128f <func2+0x15f>
test   %r15d,%r15d
jle    1230 <func2+0x100>
mov    %r12,%rax
imul   0x8(%rsp),%rax
mov    0x18(%rsp),%rcx
lea    (%rcx,%rax,8),%rbp
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x2(%rbx),%eax
movsd  0x0(%rbp,%rax,8),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
jg     1270 <func2+0x140>
jmp    1230 <func2+0x100>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd67(%rip),%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"source:\0A\00"
@.str.1 = [4 x i8] c"%f\09\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [9 x i8] c"target:\0A\00"
define void @func2(i32 %0, i32 %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store double* %2, double** %7
store double* %3, double** %8
%11 = load i32, i32* %6
%12 = zext i32 %11 to i64
%13 = load i32, i32* %6
%14 = zext i32 %13 to i64
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* %5
store i32 %16, i32* %9
br label %17
17: ; preds = %44, %4
%18 = load i32, i32* %9
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %47
20: ; preds = %17
%21 = load i32, i32* %6
store i32 %21, i32* %10
br label %22
22: ; preds = %39, %20
%23 = load i32, i32* %10
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %42
25: ; preds = %22
%26 = load double*, double** %8
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = mul nsw i64 %28, %14
%30 = getelementptr inbounds double, double* %26, i64 %29
%31 = mul nsw i64 -1, %14
%32 = getelementptr inbounds double, double* %30, i64 %31
%33 = load i32, i32* %10
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %32, i64 %35
%37 = load double, double* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %37)
br label %39
39: ; preds = %25
%40 = load i32, i32* %10
%41 = add nsw i32 %40, -1
store i32 %41, i32* %10
br label %22
42: ; preds = %22
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42
%45 = load i32, i32* %9
%46 = add nsw i32 %45, -1
store i32 %46, i32* %9
br label %17
47: ; preds = %17
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%49 = load i32, i32* %5
store i32 %49, i32* %9
br label %50
50: ; preds = %77, %47
%51 = load i32, i32* %9
%52 = icmp sgt i32 %51, 0
br i1 %52, label %53, label %80
53: ; preds = %50
%54 = load i32, i32* %6
store i32 %54, i32* %10
br label %55
55: ; preds = %72, %53
%56 = load i32, i32* %10
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %75
58: ; preds = %55
%59 = load double*, double** %7
%60 = load i32, i32* %9
%61 = sext i32 %60 to i64
%62 = mul nsw i64 %61, %12
%63 = getelementptr inbounds double, double* %59, i64 %62
%64 = mul nsw i64 -1, %12
%65 = getelementptr inbounds double, double* %63, i64 %64
%66 = load i32, i32* %10
%67 = sub nsw i32 %66, 1
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %65, i64 %68
%70 = load double, double* %69
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %70)
br label %72
72: ; preds = %58
%73 = load i32, i32* %10
%74 = add nsw i32 %73, -1
store i32 %74, i32* %10
br label %55
75: ; preds = %55
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %77
77: ; preds = %75
%78 = load i32, i32* %9
%79 = add nsw i32 %78, -1
store i32 %79, i32* %9
br label %50
80: ; preds = %50
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%f\09\00"
@str = [8 x i8] c"source:\00"
@str.4 = [8 x i8] c"target:\00"
define void @func2(i32 %0, i32 %1, double* nocapture %2, double* nocapture %3) {
%5 = zext i32 %1 to i64
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%7 = icmp sgt i32 %0, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0))
br label %56
10: ; preds = %4
%11 = icmp sgt i32 %1, 0
%12 = sub nsw i64 0, %5
%13 = zext i32 %0 to i64
%14 = getelementptr inbounds double, double* %3, i64 %12
br label %15
15: ; preds = %10, %28
%16 = phi i64 [ %13, %10 ], [ %30, %28 ]
br i1 %11, label %17, label %28
17: ; preds = %15
%18 = mul nsw i64 %16, %5
%19 = getelementptr inbounds double, double* %14, i64 %18
br label %20
20: ; preds = %17, %20
%21 = phi i64 [ %5, %17 ], [ %22, %20 ]
%22 = add nsw i64 %21, -1
%23 = and i64 %22, 4294967295
%24 = getelementptr inbounds double, double* %19, i64 %23
%25 = load double, double* %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %25)
%27 = icmp sgt i64 %21, 1
br i1 %27, label %20, label %28
28: ; preds = %20, %15
%29 = tail call i32 @putchar(i32 10)
%30 = add nsw i64 %16, -1
%31 = icmp sgt i64 %16, 1
br i1 %31, label %15, label %32
32: ; preds = %28
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0))
br i1 %7, label %34, label %56
34: ; preds = %32
%35 = icmp sgt i32 %1, 0
%36 = sub nsw i64 0, %5
%37 = zext i32 %0 to i64
%38 = getelementptr inbounds double, double* %2, i64 %36
br label %39
39: ; preds = %34, %52
%40 = phi i64 [ %37, %34 ], [ %54, %52 ]
br i1 %35, label %41, label %52
41: ; preds = %39
%42 = mul nsw i64 %40, %5
%43 = getelementptr inbounds double, double* %38, i64 %42
br label %44
44: ; preds = %41, %44
%45 = phi i64 [ %5, %41 ], [ %46, %44 ]
%46 = add nsw i64 %45, -1
%47 = and i64 %46, 4294967295
%48 = getelementptr inbounds double, double* %43, i64 %47
%49 = load double, double* %48
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %49)
%51 = icmp sgt i64 %45, 1
br i1 %51, label %44, label %52
52: ; preds = %44, %39
%53 = tail call i32 @putchar(i32 10)
%54 = add nsw i64 %40, -1
%55 = icmp sgt i64 %40, 1
br i1 %55, label %39, label %56
56: ; preds = %52, %8, %32
ret void
}