#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 */
double dmin(double, double);
void min_dmatrix(double **d, long nr, long nc, double *mindm) {
  long i, j;
  for (i = 1; i <= nc; i++) {
    mindm[i] = 1.0e+18;
    for (j = 1; j <= nr; j++)
      mindm[i] = dmin(mindm[i], d[j][i]);
  }
}


x86 assembly (clang, -O0):
<min_dmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     11c4 <min_dmatrix+0xb4>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  0xeb2(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movq   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     11ae <min_dmatrix+0x9e>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <dmin@plt>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    115b <min_dmatrix+0x4b>
jmp    11b3 <min_dmatrix+0xa3>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1130 <min_dmatrix+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_dmatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
jle    1190 <min_dmatrix+0x80>
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r12
mov    $0x1,%ebp
jmp    114c <min_dmatrix+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rbp),%rax
cmp    %r14,%rbp
mov    %rax,%rbp
je     1190 <min_dmatrix+0x80>
movabs $0x43abc16d674ec800,%rax
c1 ab 43
mov    %rax,(%r15,%rbp,8)
test   %rbx,%rbx
jle    1140 <min_dmatrix+0x30>
xor    %r13d,%r13d
movsd  0xe96(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
mov    0x8(%r12,%r13,8),%rax
movsd  (%rax,%rbp,8),%xmm1
call   1030 <dmin@plt>
movsd  %xmm0,(%r15,%rbp,8)
add    $0x1,%r13
cmp    %r13,%rbx
jne    1170 <min_dmatrix+0x60>
jmp    1140 <min_dmatrix+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @min_dmatrix(double** %0, i64 %1, i64 %2, double* %3) {
%5 = alloca double**
%6 = alloca i64
%7 = alloca i64
%8 = alloca double*
%9 = alloca i64
%10 = alloca i64
store double** %0, double*** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store double* %3, double** %8
store i64 1, i64* %9
br label %11
11: ; preds = %43, %4
%12 = load i64, i64* %9
%13 = load i64, i64* %7
%14 = icmp sle i64 %12, %13
br i1 %14, label %15, label %46
15: ; preds = %11
%16 = load double*, double** %8
%17 = load i64, i64* %9
%18 = getelementptr inbounds double, double* %16, i64 %17
store double 1.000000e+18, double* %18
store i64 1, i64* %10
br label %19
19: ; preds = %39, %15
%20 = load i64, i64* %10
%21 = load i64, i64* %6
%22 = icmp sle i64 %20, %21
br i1 %22, label %23, label %42
23: ; preds = %19
%24 = load double*, double** %8
%25 = load i64, i64* %9
%26 = getelementptr inbounds double, double* %24, i64 %25
%27 = load double, double* %26
%28 = load double**, double*** %5
%29 = load i64, i64* %10
%30 = getelementptr inbounds double*, double** %28, i64 %29
%31 = load double*, double** %30
%32 = load i64, i64* %9
%33 = getelementptr inbounds double, double* %31, i64 %32
%34 = load double, double* %33
%35 = call double @dmin(double %27, double %34)
%36 = load double*, double** %8
%37 = load i64, i64* %9
%38 = getelementptr inbounds double, double* %36, i64 %37
store double %35, double* %38
br label %39
39: ; preds = %23
%40 = load i64, i64* %10
%41 = add nsw i64 %40, 1
store i64 %41, i64* %10
br label %19
42: ; preds = %19
br label %43
43: ; preds = %42
%44 = load i64, i64* %9
%45 = add nsw i64 %44, 1
store i64 %45, i64* %9
br label %11
46: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @min_dmatrix(double** nocapture %0, i64 %1, i64 %2, double* nocapture %3) {
%5 = icmp slt i64 %2, 1
br i1 %5, label %24, label %6
6: ; preds = %4
%7 = icmp slt i64 %1, 1
br label %8
8: ; preds = %6, %21
%9 = phi i64 [ 1, %6 ], [ %22, %21 ]
%10 = getelementptr inbounds double, double* %3, i64 %9
store double 1.000000e+18, double* %10
br i1 %7, label %21, label %11
11: ; preds = %8, %11
%12 = phi double [ %18, %11 ], [ 1.000000e+18, %8 ]
%13 = phi i64 [ %19, %11 ], [ 1, %8 ]
%14 = getelementptr inbounds double*, double** %0, i64 %13
%15 = load double*, double** %14
%16 = getelementptr inbounds double, double* %15, i64 %9
%17 = load double, double* %16
%18 = tail call double @dmin(double %12, double %17)
store double %18, double* %10
%19 = add nuw i64 %13, 1
%20 = icmp eq i64 %13, %1
br i1 %20, label %21, label %11
21: ; preds = %11, %8
%22 = add nuw i64 %9, 1
%23 = icmp eq i64 %9, %2
br i1 %23, label %24, label %8
24: ; preds = %21, %4
ret void
}