void init_cpu_mic_ratio(double *device_ratio, int cpu_number, int mic_number) {
  int i;
  for (i = 0; i < cpu_number; i++) {
    device_ratio[i] = 1;
  }
  for (i = cpu_number; i < (cpu_number + mic_number); i++) {
    device_ratio[i] = 4.3;
  }
}


x86 assembly (clang, -O0):
<init_cpu_mic_ratio>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1144 <init_cpu_mic_ratio+0x44>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xed7(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <init_cpu_mic_ratio+0x15>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    117e <init_cpu_mic_ratio+0x7e>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xe95(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114a <init_cpu_mic_ratio+0x4a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_cpu_mic_ratio>:
test   %esi,%esi
jle    121d <init_cpu_mic_ratio+0x11d>
mov    %esi,%r9d
cmp    $0x4,%esi
jae    1117 <init_cpu_mic_ratio+0x17>
xor    %ecx,%ecx
jmp    11f9 <init_cpu_mic_ratio+0xf9>
mov    %r9d,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rax
mov    %rax,%r10
shr    $0x2,%r10
add    $0x1,%r10
mov    %r10d,%r8d
and    $0x7,%r8d
cmp    $0x1c,%rax
jae    1140 <init_cpu_mic_ratio+0x40>
xor    %eax,%eax
jmp    11c1 <init_cpu_mic_ratio+0xc1>
and    $0xfffffffffffffff8,%r10
xor    %eax,%eax
movaps 0xeb3(%rip),%xmm0
nopl   (%rax)
movups %xmm0,(%rdi,%rax,8)
movups %xmm0,0x10(%rdi,%rax,8)
movups %xmm0,0x20(%rdi,%rax,8)
movups %xmm0,0x30(%rdi,%rax,8)
movups %xmm0,0x40(%rdi,%rax,8)
movups %xmm0,0x50(%rdi,%rax,8)
movups %xmm0,0x60(%rdi,%rax,8)
movups %xmm0,0x70(%rdi,%rax,8)
movups %xmm0,0x80(%rdi,%rax,8)
movups %xmm0,0x90(%rdi,%rax,8)
movups %xmm0,0xa0(%rdi,%rax,8)
movups %xmm0,0xb0(%rdi,%rax,8)
movups %xmm0,0xc0(%rdi,%rax,8)
movups %xmm0,0xd0(%rdi,%rax,8)
movups %xmm0,0xe0(%rdi,%rax,8)
movups %xmm0,0xf0(%rdi,%rax,8)
add    $0x20,%rax
add    $0xfffffffffffffff8,%r10
jne    1150 <init_cpu_mic_ratio+0x50>
test   %r8,%r8
je     11f4 <init_cpu_mic_ratio+0xf4>
lea    (%rdi,%rax,8),%r10
add    $0x10,%r10
shl    $0x5,%r8
xor    %eax,%eax
movaps 0xe25(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movups %xmm0,-0x10(%r10,%rax,1)
movups %xmm0,(%r10,%rax,1)
add    $0x20,%rax
cmp    %rax,%r8
jne    11e0 <init_cpu_mic_ratio+0xe0>
cmp    %r9,%rcx
je     121d <init_cpu_mic_ratio+0x11d>
movabs $0x3ff0000000000000,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,(%rdi,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%r9
jne    1210 <init_cpu_mic_ratio+0x110>
test   %edx,%edx
jle    131d <init_cpu_mic_ratio+0x21d>
add    %esi,%edx
movslq %esi,%rax
movslq %edx,%r11
lea    0x1(%rax),%r9
cmp    %r11,%r9
cmovle %r11,%r9
sub    %rax,%r9
cmp    $0x4,%r9
jb     12fa <init_cpu_mic_ratio+0x1fa>
mov    %r9,%r8
and    $0xfffffffffffffffc,%r8
lea    -0x4(%r8),%rcx
mov    %rcx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%r10d
and    $0x3,%r10d
cmp    $0xc,%rcx
jae    126c <init_cpu_mic_ratio+0x16c>
xor    %edx,%edx
jmp    12c1 <init_cpu_mic_ratio+0x1c1>
movabs $0x7ffffffffffffff8,%rcx
ff ff 7f
or     $0x4,%rcx
and    %rcx,%rsi
lea    (%rdi,%rax,8),%rcx
add    $0x70,%rcx
xor    %edx,%edx
movaps 0xd82(%rip),%xmm0
xchg   %ax,%ax
movups %xmm0,-0x70(%rcx,%rdx,8)
movups %xmm0,-0x60(%rcx,%rdx,8)
movups %xmm0,-0x50(%rcx,%rdx,8)
movups %xmm0,-0x40(%rcx,%rdx,8)
movups %xmm0,-0x30(%rcx,%rdx,8)
movups %xmm0,-0x20(%rcx,%rdx,8)
movups %xmm0,-0x10(%rcx,%rdx,8)
movups %xmm0,(%rcx,%rdx,8)
add    $0x10,%rdx
add    $0xfffffffffffffffc,%rsi
jne    1290 <init_cpu_mic_ratio+0x190>
test   %r10,%r10
je     12f2 <init_cpu_mic_ratio+0x1f2>
add    %rax,%rdx
lea    (%rdi,%rdx,8),%rcx
add    $0x10,%rcx
shl    $0x5,%r10
xor    %edx,%edx
movaps 0xd32(%rip),%xmm0
xchg   %ax,%ax
movups %xmm0,-0x10(%rcx,%rdx,1)
movups %xmm0,(%rcx,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%r10
jne    12e0 <init_cpu_mic_ratio+0x1e0>
cmp    %r8,%r9
je     131d <init_cpu_mic_ratio+0x21d>
add    %r8,%rax
movabs $0x4011333333333333,%rcx
33 11 40
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rcx,(%rdi,%rax,8)
add    $0x1,%rax
cmp    %r11,%rax
jl     1310 <init_cpu_mic_ratio+0x210>
ret

LLVM IR (-O0):
define void @init_cpu_mic_ratio(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %17, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load double*, double** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
store double 1.000000e+00, double* %16
br label %17
17: ; preds = %12
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %8
20: ; preds = %8
%21 = load i32, i32* %5
store i32 %21, i32* %7
br label %22
22: ; preds = %33, %20
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = add nsw i32 %24, %25
%27 = icmp slt i32 %23, %26
br i1 %27, label %28, label %36
28: ; preds = %22
%29 = load double*, double** %4
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
store double 4.300000e+00, double* %32
br label %33
33: ; preds = %28
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %22
36: ; preds = %22
ret void
}

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