#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 pow(double, double);
void typeII_migration(int *n, int type[], double *fg, double *C2, double *alpha,
                      double Mp[], double a[], double *M, double *dt) {
  int i;
  double tau_mig2p, tau_mig2d, tau_mig;
  for (i = 0; i < *n; i++) {
    if (type[i] == 2 || type[i] == 3) {
      tau_mig2p = 5.0e5 * pow(*fg, -1.0) * pow(*C2 * (*alpha) / 1.0e-4, -1.0) *
                  (Mp[i] / 1.8986e30) * pow(a[i], 0.5) *
                  pow(*M / 1.9884e33, -0.5);
      tau_mig2d = 0.7e5 * pow((*alpha) / 1.0e-3, -1.0) * a[i] *
                  pow(*M / 1.9884e33, -0.5);
      if (tau_mig2d > tau_mig2p)
        tau_mig = tau_mig2d;
      else
        tau_mig = tau_mig2p;
      a[i] -= *dt * a[i] / tau_mig;
      if (a[i] < 0.01) {
        a[i] = 0.0;
        type[i] = 4;
      }
    }
  }
}


x86 assembly (clang, -O0):
<typeII_migration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x20(%rbp),%rax
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)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    1372 <typeII_migration+0x262>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x2,(%rax,%rcx,4)
je     1176 <typeII_migration+0x66>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x3,(%rax,%rcx,4)
jne    135f <typeII_migration+0x24f>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe92(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  0xe81(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe55(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0xe47(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xe1d(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xdd7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdc3(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xdbd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xda9(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xd91(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xd63(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd4f(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    12e6 <typeII_migration+0x1d6>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    12f0 <typeII_migration+0x1e0>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
divsd  -0x50(%rbp),%xmm1
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xd18(%rip),%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    135a <typeII_migration+0x24a>
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0x4,(%rax,%rcx,4)
jmp    135f <typeII_migration+0x24f>
jmp    1364 <typeII_migration+0x254>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1143 <typeII_migration+0x33>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<typeII_migration>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x28(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rdx,0x18(%rsp)
cmpl   $0x0,(%rdi)
jle    12bf <typeII_migration+0x1af>
mov    %r8,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x70(%rsp),%r14
xor    %r15d,%r15d
jmp    1161 <typeII_migration+0x51>
nopl   0x0(%rax)
add    $0x1,%r15
movslq 0x0(%rbp),%rax
cmp    %rax,%r15
jge    12bf <typeII_migration+0x1af>
mov    (%rbx,%r15,4),%eax
and    $0xfffffffe,%eax
cmp    $0x2,%eax
jne    1150 <typeII_migration+0x40>
movsd  0xe8b(%rip),%xmm0
mov    0x18(%rsp),%rax
divsd  (%rax),%xmm0
mulsd  0xe82(%rip),%xmm0
mov    0x20(%rsp),%rax
movsd  (%rax),%xmm1
mulsd  0x0(%r13),%xmm1
divsd  0xe73(%rip),%xmm1
movapd 0xebb(%rip),%xmm2
unpcklpd %xmm1,%xmm2
movapd 0xe9f(%rip),%xmm1
mov    0x28(%rsp),%rax
movlpd (%rax,%r15,8),%xmm1
divpd  %xmm2,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,(%rsp)
movsd  (%r14,%r15,8),%xmm0
movsd  0xe35(%rip),%xmm1
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    0x78(%rsp),%r12
movsd  (%r12),%xmm0
movsd  0xe1b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe17(%rip),%xmm1
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x0(%r13),%xmm0
divsd  0xe02(%rip),%xmm0
movsd  0xdca(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  0xdf6(%rip),%xmm1
mulsd  (%r14,%r15,8),%xmm1
movsd  %xmm1,0x30(%rsp)
movsd  (%r12),%xmm0
divsd  0xdc4(%rip),%xmm0
movsd  0xdc4(%rip),%xmm1
call   1030 <pow@plt>
mulsd  0x30(%rsp),%xmm0
maxsd  (%rsp),%xmm0
movsd  (%r14,%r15,8),%xmm1
mov    0x80(%rsp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%r14,%r15,8)
movsd  0xda0(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1150 <typeII_migration+0x40>
movq   $0x0,(%r14,%r15,8)
movl   $0x4,(%rbx,%r15,4)
jmp    1150 <typeII_migration+0x40>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @typeII_migration(i32* nocapture %0, i32* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture %8) {
%10 = load i32, i32* %0
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %67
12: ; preds = %9, %62
%13 = phi i64 [ %63, %62 ], [ 0, %9 ]
%14 = getelementptr inbounds i32, i32* %1, i64 %13
%15 = load i32, i32* %14
%16 = and i32 %15, -2
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %62
18: ; preds = %12
%19 = load double, double* %2
%20 = fdiv double 1.000000e+00, %19
%21 = fmul double %20, 5.000000e+05
%22 = load double, double* %3
%23 = load double, double* %4
%24 = fmul double %22, %23
%25 = fdiv double %24, 1.000000e-04
%26 = getelementptr inbounds double, double* %5, i64 %13
%27 = load double, double* %26
%28 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %27, i64 0
%29 = insertelement <2 x double> <double 1.898600e+30, double poison>, double %25, i64 1
%30 = fdiv <2 x double> %28, %29
%31 = extractelement <2 x double> %30, i64 1
%32 = fmul double %21, %31
%33 = extractelement <2 x double> %30, i64 0
%34 = fmul double %33, %32
%35 = getelementptr inbounds double, double* %6, i64 %13
%36 = load double, double* %35
%37 = tail call double @pow(double %36, double 5.000000e-01)
%38 = fmul double %37, %34
%39 = load double, double* %7
%40 = fdiv double %39, 1.988400e+33
%41 = tail call double @pow(double %40, double -5.000000e-01)
%42 = fmul double %41, %38
%43 = load double, double* %4
%44 = fdiv double %43, 1.000000e-03
%45 = fdiv double 1.000000e+00, %44
%46 = fmul double %45, 7.000000e+04
%47 = load double, double* %35
%48 = fmul double %47, %46
%49 = load double, double* %7
%50 = fdiv double %49, 1.988400e+33
%51 = tail call double @pow(double %50, double -5.000000e-01)
%52 = fmul double %51, %48
%53 = fcmp ogt double %52, %42
%54 = select i1 %53, double %52, double %42
%55 = load double, double* %8
%56 = load double, double* %35
%57 = fmul double %55, %56
%58 = fdiv double %57, %54
%59 = fsub double %56, %58
store double %59, double* %35
%60 = fcmp olt double %59, 1.000000e-02
br i1 %60, label %61, label %62
61: ; preds = %18
store double 0.000000e+00, double* %35
store i32 4, i32* %14
br label %62
62: ; preds = %12, %61, %18
%63 = add nuw nsw i64 %13, 1
%64 = load i32, i32* %0
%65 = sext i32 %64 to i64
%66 = icmp slt i64 %63, %65
br i1 %66, label %12, label %67
67: ; preds = %62, %9
ret void
}