#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 fabs(double);
void calc_dt(double *u, double *v, double *rho, double *dx, double *dy,
             double *dt, double *k, double *cp) {
  int i, j;
  double vel_dt = 1e6;
  double nrg_dt;
  double min_seperation;
  double max_vel, max_velx, max_vely;
  double min_rho;
  double uv, vv;
  max_velx = 0.;
  max_vely = 0.;
  min_rho = 1e6;
  for (j = 0; j < 51; j++) {
    for (i = 0; i < 101; i++) {
      uv = fabs(u[101 * j + i]);
      vv = fabs(v[101 * j + i]);
      max_velx = uv > max_velx ? uv : max_velx;
      max_vely = vv > max_vely ? vv : max_vely;
      min_rho = rho[101 * j + i] < min_rho ? rho[101 * j + i] : min_rho;
    }
  }
  max_vel = max_velx > max_vely ? max_velx : max_vely;
  min_seperation = *dx < *dy ? *dx : *dy;
  if (max_vel != 0)
    vel_dt = 1e-3 * min_seperation / (max_vel * 2);
  nrg_dt = (min_seperation * min_seperation) / (*k / min_rho * *cp);
  *dt = vel_dt < nrg_dt ? vel_dt : nrg_dt;
}


x86 assembly (clang, -O0):
<calc_dt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x33,-0x38(%rbp)
jge    12af <calc_dt+0x1af>
movl   $0x0,-0x34(%rbp)
cmpl   $0x65,-0x34(%rbp)
jge    129c <calc_dt+0x19c>
mov    -0x8(%rbp),%rax
imul   $0x65,-0x38(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xe92(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
imul   $0x65,-0x38(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xe6f(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    11dc <calc_dt+0xdc>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    11e9 <calc_dt+0xe9>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x80(%rbp),%xmm0
ucomisd -0x68(%rbp),%xmm0
jbe    1218 <calc_dt+0x118>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    1225 <calc_dt+0x125>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%rax
imul   $0x65,-0x38(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1274 <calc_dt+0x174>
mov    -0x18(%rbp),%rax
imul   $0x65,-0x38(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    1281 <calc_dt+0x181>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x70(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    116a <calc_dt+0x6a>
jmp    12a1 <calc_dt+0x1a1>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1159 <calc_dt+0x59>
movsd  -0x60(%rbp),%xmm0
ucomisd -0x68(%rbp),%xmm0
jbe    12d1 <calc_dt+0x1d1>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    12de <calc_dt+0x1de>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    131a <calc_dt+0x21a>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
jmp    132a <calc_dt+0x22a>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1354 <calc_dt+0x254>
jp     1354 <calc_dt+0x254>
jmp    1377 <calc_dt+0x277>
movsd  0xcb4(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  0xc9f(%rip),%xmm1
mulsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm1
divsd  -0x70(%rbp),%xmm1
mov    0x18(%rbp),%rax
mulsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13c5 <calc_dt+0x2c5>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
jmp    13d2 <calc_dt+0x2d2>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_dt>:
push   %rbx
xorpd  %xmm2,%xmm2
movsd  0xef3(%rip),%xmm0
mov    0x18(%rsp),%r10
mov    0x10(%rsp),%r11
xor    %eax,%eax
movapd 0xeef(%rip),%xmm3
xorpd  %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm1,%xmm4
movapd %xmm2,%xmm5
movapd %xmm0,%xmm6
movsd  (%rdi,%rbx,8),%xmm1
andpd  %xmm3,%xmm1
movsd  (%rsi,%rbx,8),%xmm2
andpd  %xmm3,%xmm2
maxsd  %xmm4,%xmm1
maxsd  %xmm5,%xmm2
movsd  (%rdx,%rbx,8),%xmm0
minsd  %xmm6,%xmm0
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    1140 <calc_dt+0x40>
add    $0x1,%rax
add    $0x328,%rdx
add    $0x328,%rsi
add    $0x328,%rdi
cmp    $0x33,%rax
jne    1130 <calc_dt+0x30>
movsd  (%rcx),%xmm3
minsd  (%r8),%xmm3
maxsd  %xmm2,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    11b1 <calc_dt+0xb1>
jnp    11c7 <calc_dt+0xc7>
movsd  0xe4f(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm2
jmp    11cf <calc_dt+0xcf>
movsd  0xe31(%rip),%xmm2
movsd  (%r11),%xmm1
divsd  %xmm0,%xmm1
mulsd  (%r10),%xmm1
mulsd  %xmm3,%xmm3
divsd  %xmm1,%xmm3
minsd  %xmm3,%xmm2
movsd  %xmm2,(%r9)
pop    %rbx
ret

LLVM IR (-O0):
define void @calc_dt(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
store double* %0, double** %9
store double* %1, double** %10
store double* %2, double** %11
store double* %3, double** %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
store double 1.000000e+06, double* %19
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
store double 1.000000e+06, double* %25
store i32 0, i32* %18
br label %28
28: ; preds = %99, %8
%29 = load i32, i32* %18
%30 = icmp slt i32 %29, 51
br i1 %30, label %31, label %102
31: ; preds = %28
store i32 0, i32* %17
br label %32
32: ; preds = %95, %31
%33 = load i32, i32* %17
%34 = icmp slt i32 %33, 101
br i1 %34, label %35, label %98
35: ; preds = %32
%36 = load double*, double** %9
%37 = load i32, i32* %18
%38 = mul nsw i32 101, %37
%39 = load i32, i32* %17
%40 = add nsw i32 %38, %39
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %36, i64 %41
%43 = load double, double* %42
%44 = call double @llvm.fabs.f64(double %43)
store double %44, double* %26
%45 = load double*, double** %10
%46 = load i32, i32* %18
%47 = mul nsw i32 101, %46
%48 = load i32, i32* %17
%49 = add nsw i32 %47, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %45, i64 %50
%52 = load double, double* %51
%53 = call double @llvm.fabs.f64(double %52)
store double %53, double* %27
%54 = load double, double* %26
%55 = load double, double* %23
%56 = fcmp ogt double %54, %55
br i1 %56, label %57, label %59
57: ; preds = %35
%58 = load double, double* %26
br label %61
59: ; preds = %35
%60 = load double, double* %23
br label %61
61: ; preds = %59, %57
%62 = phi double [ %58, %57 ], [ %60, %59 ]
store double %62, double* %23
%63 = load double, double* %27
%64 = load double, double* %24
%65 = fcmp ogt double %63, %64
br i1 %65, label %66, label %68
66: ; preds = %61
%67 = load double, double* %27
br label %70
68: ; preds = %61
%69 = load double, double* %24
br label %70
70: ; preds = %68, %66
%71 = phi double [ %67, %66 ], [ %69, %68 ]
store double %71, double* %24
%72 = load double*, double** %11
%73 = load i32, i32* %18
%74 = mul nsw i32 101, %73
%75 = load i32, i32* %17
%76 = add nsw i32 %74, %75
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %72, i64 %77
%79 = load double, double* %78
%80 = load double, double* %25
%81 = fcmp olt double %79, %80
br i1 %81, label %82, label %91
82: ; preds = %70
%83 = load double*, double** %11
%84 = load i32, i32* %18
%85 = mul nsw i32 101, %84
%86 = load i32, i32* %17
%87 = add nsw i32 %85, %86
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %83, i64 %88
%90 = load double, double* %89
br label %93
91: ; preds = %70
%92 = load double, double* %25
br label %93
93: ; preds = %91, %82
%94 = phi double [ %90, %82 ], [ %92, %91 ]
store double %94, double* %25
br label %95
95: ; preds = %93
%96 = load i32, i32* %17
%97 = add nsw i32 %96, 1
store i32 %97, i32* %17
br label %32
98: ; preds = %32
br label %99
99: ; preds = %98
%100 = load i32, i32* %18
%101 = add nsw i32 %100, 1
store i32 %101, i32* %18
br label %28
102: ; preds = %28
%103 = load double, double* %23
%104 = load double, double* %24
%105 = fcmp ogt double %103, %104
br i1 %105, label %106, label %108
106: ; preds = %102
%107 = load double, double* %23
br label %110
108: ; preds = %102
%109 = load double, double* %24
br label %110
110: ; preds = %108, %106
%111 = phi double [ %107, %106 ], [ %109, %108 ]
store double %111, double* %22
%112 = load double*, double** %12
%113 = load double, double* %112
%114 = load double*, double** %13
%115 = load double, double* %114
%116 = fcmp olt double %113, %115
br i1 %116, label %117, label %120
117: ; preds = %110
%118 = load double*, double** %12
%119 = load double, double* %118
br label %123
120: ; preds = %110
%121 = load double*, double** %13
%122 = load double, double* %121
br label %123
123: ; preds = %120, %117
%124 = phi double [ %119, %117 ], [ %122, %120 ]
store double %124, double* %21
%125 = load double, double* %22
%126 = fcmp une double %125, 0.000000e+00
br i1 %126, label %127, label %133
127: ; preds = %123
%128 = load double, double* %21
%129 = fmul double 1.000000e-03, %128
%130 = load double, double* %22
%131 = fmul double %130, 2.000000e+00
%132 = fdiv double %129, %131
store double %132, double* %19
br label %133
133: ; preds = %127, %123
%134 = load double, double* %21
%135 = load double, double* %21
%136 = fmul double %134, %135
%137 = load double*, double** %15
%138 = load double, double* %137
%139 = load double, double* %25
%140 = fdiv double %138, %139
%141 = load double*, double** %16
%142 = load double, double* %141
%143 = fmul double %140, %142
%144 = fdiv double %136, %143
store double %144, double* %20
%145 = load double, double* %19
%146 = load double, double* %20
%147 = fcmp olt double %145, %146
br i1 %147, label %148, label %150
148: ; preds = %133
%149 = load double, double* %19
br label %152
150: ; preds = %133
%151 = load double, double* %20
br label %152
152: ; preds = %150, %148
%153 = phi double [ %149, %148 ], [ %151, %150 ]
%154 = load double*, double** %14
store double %153, double* %154
ret void
}

LLVM IR (-O2):
define void @calc_dt(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture writeonly %5, double* nocapture %6, double* nocapture %7) {
br label %9
9: ; preds = %8, %37
%10 = phi i64 [ 0, %8 ], [ %38, %37 ]
%11 = phi double [ 1.000000e+06, %8 ], [ %34, %37 ]
%12 = phi double [ 0.000000e+00, %8 ], [ %30, %37 ]
%13 = phi double [ 0.000000e+00, %8 ], [ %28, %37 ]
%14 = mul nuw nsw i64 %10, 101
br label %15
15: ; preds = %9, %15
%16 = phi i64 [ 0, %9 ], [ %35, %15 ]
%17 = phi double [ %11, %9 ], [ %34, %15 ]
%18 = phi double [ %12, %9 ], [ %30, %15 ]
%19 = phi double [ %13, %9 ], [ %28, %15 ]
%20 = add nuw nsw i64 %16, %14
%21 = getelementptr inbounds double, double* %0, i64 %20
%22 = load double, double* %21
%23 = tail call double @llvm.fabs.f64(double %22)
%24 = getelementptr inbounds double, double* %1, i64 %20
%25 = load double, double* %24
%26 = tail call double @llvm.fabs.f64(double %25)
%27 = fcmp ogt double %23, %19
%28 = select i1 %27, double %23, double %19
%29 = fcmp ogt double %26, %18
%30 = select i1 %29, double %26, double %18
%31 = getelementptr inbounds double, double* %2, i64 %20
%32 = load double, double* %31
%33 = fcmp olt double %32, %17
%34 = select i1 %33, double %32, double %17
%35 = add nuw nsw i64 %16, 1
%36 = icmp eq i64 %35, 101
br i1 %36, label %37, label %15
37: ; preds = %15
%38 = add nuw nsw i64 %10, 1
%39 = icmp eq i64 %38, 51
br i1 %39, label %40, label %9
40: ; preds = %37
%41 = fcmp ogt double %28, %30
%42 = select i1 %41, double %28, double %30
%43 = load double, double* %3
%44 = load double, double* %4
%45 = fcmp olt double %43, %44
%46 = select i1 %45, double %43, double %44
%47 = fcmp une double %42, 0.000000e+00
br i1 %47, label %48, label %52
48: ; preds = %40
%49 = fmul double %46, 1.000000e-03
%50 = fmul double %42, 2.000000e+00
%51 = fdiv double %49, %50
br label %52
52: ; preds = %48, %40
%53 = phi double [ %51, %48 ], [ 1.000000e+06, %40 ]
%54 = fmul double %46, %46
%55 = load double, double* %6
%56 = fdiv double %55, %34
%57 = load double, double* %7
%58 = fmul double %56, %57
%59 = fdiv double %54, %58
%60 = fcmp olt double %53, %59
%61 = select i1 %60, double %53, double %59
store double %61, double* %5
ret void
}