#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void Print_dists(int dist[], int n, FILE *fp) {
  int v;
  fprintf(fp, "  v    dist 0->v\n");
  fprintf(fp, "----   ---------\n");
  for (v = 1; v < n; v++)
    fprintf(fp, "%3d       %4d\n", v, dist[v]);
  fprintf(fp, "\n");
}


x86 assembly (clang, -O0):
<Print_dists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xed2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1188 <Print_dists+0x78>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114e <Print_dists+0x3e>
mov    -0x18(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print_dists>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xeb9(%rip),%rdi
mov    $0x1,%ebx
mov    $0x11,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xead(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
cmp    $0x2,%ebp
jl     11ac <Print_dists+0x7c>
mov    %ebp,%ebp
lea    0xe9f(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,4),%ecx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <Print_dists+0x60>
mov    $0xa,%edi
mov    %r15,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [18 x i8] c" v dist 0->v\0A\00"
@.str.1 = [18 x i8] c"---- ---------\0A\00"
@.str.2 = [15 x i8] c"%3d %4d\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @Print_dists(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = load i32*, i32** %6
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %7
br label %12
12: ; preds = %25, %3
%13 = load i32, i32* %7
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i32*, i32** %6
%18 = load i32, i32* %7
%19 = load i32*, i32** %4
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %23)
br label %25
25: ; preds = %16
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %12
28: ; preds = %12
%29 = load i32*, i32** %6
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c" v dist 0->v\0A\00"
@.str.1 = [18 x i8] c"---- ---------\0A\00"
@.str.2 = [15 x i8] c"%3d %4d\0A\00"
define void @Print_dists(i32* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 17, i64 1, i32* %2)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i64 17, i64 1, i32* %2)
%6 = icmp sgt i32 %1, 1
br i1 %6, label %7, label %17
7: ; preds = %3
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 1, %7 ], [ %15, %9 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = trunc i64 %10 to i32
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %12)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %3
%18 = tail call i32 @fputc(i32 10, i32* %2)
ret void
}