void initialize_single_source(double d[], int pi[], int s, int n) {
  int i;
  for (i = 1; i <= n; ++i) {
    d[i] = 1000000000.0;
    pi[i] = 0;
  }
  d[s] = 0.0;
}


x86 assembly (clang, -O0):
<initialize_single_source>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1157 <initialize_single_source+0x57>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  0xecb(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1119 <initialize_single_source+0x19>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_single_source>:
test   %ecx,%ecx
jle    1215 <initialize_single_source+0x115>
mov    %ecx,%r8d
mov    $0x1,%r11d
cmp    $0x4,%ecx
jb     11e7 <initialize_single_source+0xe7>
mov    %r8d,%r11d
and    $0xfffffffc,%r11d
lea    -0x4(%r11),%rcx
mov    %rcx,%r10
shr    $0x2,%r10
add    $0x1,%r10
mov    %r10d,%r9d
and    $0x3,%r9d
cmp    $0xc,%rcx
jae    1141 <initialize_single_source+0x41>
xor    %ecx,%ecx
jmp    11a6 <initialize_single_source+0xa6>
and    $0xfffffffffffffffc,%r10
xor    %ecx,%ecx
movaps 0xeb2(%rip),%xmm0
xorps  %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movups %xmm0,0x8(%rdi,%rcx,8)
movups %xmm0,0x18(%rdi,%rcx,8)
movups %xmm1,0x4(%rsi,%rcx,4)
movups %xmm0,0x28(%rdi,%rcx,8)
movups %xmm0,0x38(%rdi,%rcx,8)
movups %xmm1,0x14(%rsi,%rcx,4)
movups %xmm0,0x48(%rdi,%rcx,8)
movups %xmm0,0x58(%rdi,%rcx,8)
movups %xmm1,0x24(%rsi,%rcx,4)
movups %xmm0,0x68(%rdi,%rcx,8)
movups %xmm0,0x78(%rdi,%rcx,8)
movups %xmm1,0x34(%rsi,%rcx,4)
add    $0x10,%rcx
add    $0xfffffffffffffffc,%r10
jne    1160 <initialize_single_source+0x60>
test   %r9,%r9
je     11de <initialize_single_source+0xde>
movaps 0xe4e(%rip),%xmm0
xorps  %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rcx,%rax
or     $0x1,%rax
movups %xmm0,(%rdi,%rax,8)
movups %xmm0,0x10(%rdi,%rax,8)
movups %xmm1,(%rsi,%rax,4)
add    $0x4,%rcx
add    $0xffffffffffffffff,%r9
jne    11c0 <initialize_single_source+0xc0>
cmp    %r11,%r8
je     1215 <initialize_single_source+0x115>
or     $0x1,%r11
add    $0x1,%r8
movabs $0x41cdcd6500000000,%rcx
cd cd 41
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rcx,(%rdi,%r11,8)
movl   $0x0,(%rsi,%r11,4)
add    $0x1,%r11
cmp    %r11,%r8
jne    1200 <initialize_single_source+0x100>
movslq %edx,%rax
movq   $0x0,(%rdi,%rax,8)
ret

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

LLVM IR (-O2):
define void @initialize_single_source(double* nocapture writeonly %0, i32* nocapture writeonly %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %3, 1
br i1 %5, label %91, label %6
6: ; preds = %4
%7 = add nuw i32 %3, 1
%8 = zext i32 %7 to i64
%9 = add nsw i64 %8, -1
%10 = icmp ult i64 %9, 4
br i1 %10, label %83, label %11
11: ; preds = %6
%12 = and i64 %9, -4
%13 = or i64 %12, 1
%14 = add nsw i64 %12, -4
%15 = lshr exact i64 %14, 2
%16 = add nuw nsw i64 %15, 1
%17 = and i64 %16, 3
%18 = icmp ult i64 %14, 12
br i1 %18, label %63, label %19
19: ; preds = %11
%20 = and i64 %16, 9223372036854775804
br label %21
21: ; preds = %21, %19
%22 = phi i64 [ 0, %19 ], [ %60, %21 ]
%23 = phi i64 [ 0, %19 ], [ %61, %21 ]
%24 = or i64 %22, 1
%25 = getelementptr inbounds double, double* %0, i64 %24
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <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+09, double 1.000000e+09>, <2 x double>* %28
%29 = getelementptr inbounds i32, i32* %1, i64 %24
%30 = bitcast i32* %29 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %30
%31 = getelementptr inbounds i32, i32* %29, i64 2
%32 = bitcast i32* %31 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %32
%33 = or i64 %22, 5
%34 = getelementptr inbounds double, double* %0, i64 %33
%35 = bitcast double* %34 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <2 x double>* %35
%36 = getelementptr inbounds double, double* %34, i64 2
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <2 x double>* %37
%38 = getelementptr inbounds i32, i32* %1, i64 %33
%39 = bitcast i32* %38 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %39
%40 = getelementptr inbounds i32, i32* %38, i64 2
%41 = bitcast i32* %40 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %41
%42 = or i64 %22, 9
%43 = getelementptr inbounds double, double* %0, i64 %42
%44 = bitcast double* %43 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <2 x double>* %44
%45 = getelementptr inbounds double, double* %43, i64 2
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <2 x double>* %46
%47 = getelementptr inbounds i32, i32* %1, i64 %42
%48 = bitcast i32* %47 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %48
%49 = getelementptr inbounds i32, i32* %47, i64 2
%50 = bitcast i32* %49 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %50
%51 = or i64 %22, 13
%52 = getelementptr inbounds double, double* %0, i64 %51
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <2 x double>* %53
%54 = getelementptr inbounds double, double* %52, i64 2
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <2 x double>* %55
%56 = getelementptr inbounds i32, i32* %1, i64 %51
%57 = bitcast i32* %56 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %57
%58 = getelementptr inbounds i32, i32* %56, i64 2
%59 = bitcast i32* %58 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %59
%60 = add nuw i64 %22, 16
%61 = add nuw i64 %23, 4
%62 = icmp eq i64 %61, %20
br i1 %62, label %63, label %21
63: ; preds = %21, %11
%64 = phi i64 [ 0, %11 ], [ %60, %21 ]
%65 = icmp eq i64 %17, 0
br i1 %65, label %81, label %66
66: ; preds = %63, %66
%67 = phi i64 [ %78, %66 ], [ %64, %63 ]
%68 = phi i64 [ %79, %66 ], [ 0, %63 ]
%69 = or i64 %67, 1
%70 = getelementptr inbounds double, double* %0, i64 %69
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <2 x double>* %71
%72 = getelementptr inbounds double, double* %70, i64 2
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> <double 1.000000e+09, double 1.000000e+09>, <2 x double>* %73
%74 = getelementptr inbounds i32, i32* %1, i64 %69
%75 = bitcast i32* %74 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %75
%76 = getelementptr inbounds i32, i32* %74, i64 2
%77 = bitcast i32* %76 to <2 x i32>*
store <2 x i32> zeroinitializer, <2 x i32>* %77
%78 = add nuw i64 %67, 4
%79 = add i64 %68, 1
%80 = icmp eq i64 %79, %17
br i1 %80, label %81, label %66
81: ; preds = %66, %63
%82 = icmp eq i64 %9, %12
br i1 %82, label %91, label %83
83: ; preds = %6, %81
%84 = phi i64 [ 1, %6 ], [ %13, %81 ]
br label %85
85: ; preds = %83, %85
%86 = phi i64 [ %89, %85 ], [ %84, %83 ]
%87 = getelementptr inbounds double, double* %0, i64 %86
store double 1.000000e+09, double* %87
%88 = getelementptr inbounds i32, i32* %1, i64 %86
store i32 0, i32* %88
%89 = add nuw nsw i64 %86, 1
%90 = icmp eq i64 %89, %8
br i1 %90, label %91, label %85
91: ; preds = %85, %81, %4
%92 = sext i32 %2 to i64
%93 = getelementptr inbounds double, double* %0, i64 %92
store double 0.000000e+00, double* %93
ret void
}