#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 */
int /*<<< orphan*/ get_adjacent_vertice(int, int, int *, int *, int *, int *);
int *get_adjmatrix();
int /*<<< orphan*/ printf(char *, ...);
void test_get_adjacent_vertice() {
  int i, start = 2;
  int distance[6], accepted[6], predecessor[6];
  for (i = 0; i < 6; ++i) {
    distance[i] = 9999;
    accepted[i] = 0;
  }
  int next = start;
  distance[next] = 0;
  accepted[next] = 1;
  int *dist = get_adjmatrix();
  get_adjacent_vertice(next, 6, accepted, dist, distance, predecessor);
  int k;
  printf("distance[]:\t");
  for (k = 0; k < 6; ++k)
    printf("%d\t", distance[k]);
  printf("\n");
  printf("accepted[]:\t");
  for (k = 0; k < 6; ++k)
    printf("%d\t", accepted[k]);
  printf("\n");
  printf("predecessor[]:\t");
  for (k = 0; k < 6; ++k)
    printf("%d\t", predecessor[k]);
  printf("\n");
}


x86 assembly (clang, -O0):
<test_get_adjacent_vertice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x2,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x6,-0x4(%rbp)
jge    1179 <test_get_adjacent_vertice+0x49>
movslq -0x4(%rbp),%rax
movl   $0x270f,-0x20(%rbp,%rax,4)
movslq -0x4(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1149 <test_get_adjacent_vertice+0x19>
mov    -0x8(%rbp),%eax
mov    %eax,-0x64(%rbp)
movslq -0x64(%rbp),%rax
movl   $0x0,-0x20(%rbp,%rax,4)
movslq -0x64(%rbp),%rax
movl   $0x1,-0x40(%rbp,%rax,4)
mov    $0x0,%al
call   1050 <get_adjmatrix@plt>
mov    %rax,-0x70(%rbp)
mov    -0x64(%rbp),%edi
lea    -0x40(%rbp),%rdx
mov    -0x70(%rbp),%rcx
lea    -0x20(%rbp),%r8
lea    -0x60(%rbp),%r9
mov    $0x6,%esi
call   1030 <get_adjacent_vertice@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x6,-0x74(%rbp)
jge    1202 <test_get_adjacent_vertice+0xd2>
movslq -0x74(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11d4 <test_get_adjacent_vertice+0xa4>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x6,-0x74(%rbp)
jge    1253 <test_get_adjacent_vertice+0x123>
movslq -0x74(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1225 <test_get_adjacent_vertice+0xf5>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x6,-0x74(%rbp)
jge    12a4 <test_get_adjacent_vertice+0x174>
movslq -0x74(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1276 <test_get_adjacent_vertice+0x146>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_get_adjacent_vertice>:
push   %rbx
sub    $0x60,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
movabs $0x270f0000270f,%rax
mov    %rax,0x30(%rsp)
movaps 0xe95(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x1,0x8(%rsp)
xor    %eax,%eax
call   1060 <get_adjmatrix@plt>
mov    %rsp,%rdx
lea    0x20(%rsp),%r8
lea    0x40(%rsp),%r9
mov    $0x2,%edi
mov    $0x6,%esi
mov    %rax,%rcx
call   1040 <get_adjacent_vertice@plt>
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xe66(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x50(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x54(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"distance[]:\09\00"
@.str.1 = [4 x i8] c"%d\09\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [13 x i8] c"accepted[]:\09\00"
@.str.4 = [16 x i8] c"predecessor[]:\09\00"
define void @test_get_adjacent_vertice() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [6 x i32]
%4 = alloca [6 x i32]
%5 = alloca [6 x i32]
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 2, i32* %2
store i32 0, i32* %1
br label %9
9: ; preds = %19, %0
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 6
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %14
store i32 9999, i32* %15
%16 = load i32, i32* %1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 %17
store i32 0, i32* %18
br label %19
19: ; preds = %12
%20 = load i32, i32* %1
%21 = add nsw i32 %20, 1
store i32 %21, i32* %1
br label %9
22: ; preds = %9
%23 = load i32, i32* %2
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %25
store i32 0, i32* %26
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 %28
store i32 1, i32* %29
%30 = call i32* (...) @get_adjmatrix()
store i32* %30, i32** %7
%31 = load i32, i32* %6
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%33 = load i32*, i32** %7
%34 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%35 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 0
%36 = call i32 @get_adjacent_vertice(i32 %31, i32 6, i32* %32, i32* %33, i32* %34, i32* %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %38
38: ; preds = %47, %22
%39 = load i32, i32* %8
%40 = icmp slt i32 %39, 6
br i1 %40, label %41, label %50
41: ; preds = %38
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %41
%48 = load i32, i32* %8
%49 = add nsw i32 %48, 1
store i32 %49, i32* %8
br label %38
50: ; preds = %38
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %8
br label %53
53: ; preds = %62, %50
%54 = load i32, i32* %8
%55 = icmp slt i32 %54, 6
br i1 %55, label %56, label %65
56: ; preds = %53
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %56
%63 = load i32, i32* %8
%64 = add nsw i32 %63, 1
store i32 %64, i32* %8
br label %53
65: ; preds = %53
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %8
br label %68
68: ; preds = %77, %65
%69 = load i32, i32* %8
%70 = icmp slt i32 %69, 6
br i1 %70, label %71, label %80
71: ; preds = %68
%72 = load i32, i32* %8
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 %73
%75 = load i32, i32* %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %75)
br label %77
77: ; preds = %71
%78 = load i32, i32* %8
%79 = add nsw i32 %78, 1
store i32 %79, i32* %8
br label %68
80: ; preds = %68
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"distance[]:\09\00"
@.str.1 = [4 x i8] c"%d\09\00"
@.str.3 = [13 x i8] c"accepted[]:\09\00"
@.str.4 = [16 x i8] c"predecessor[]:\09\00"
define void @test_get_adjacent_vertice() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = bitcast [6 x i32]* %2 to i8*
%4 = alloca [6 x i32]
%5 = bitcast [6 x i32]* %1 to i8*
%6 = bitcast [6 x i32]* %4 to i8*
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%11 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
store i32 9999, i32* %11
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
store i32 9999, i32* %12
%13 = bitcast [6 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 9999, i32 9999, i32 0, i32 9999>, <4 x i32>* %13
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 2
store i32 1, i32* %14
%15 = tail call i32* (...) @get_adjmatrix()
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%17 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%18 = call i32 @get_adjacent_vertice(i32 2, i32 6, i32* %16, i32* %15, i32* %7, i32* %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* %7
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %8
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %9
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %10
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %11
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %12
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 @putchar(i32 10)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%34 = load i32, i32* %16
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 1
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %14
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 3
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 4
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 5
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = call i32 @putchar(i32 10)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%52 = load i32, i32* %17
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 1
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 2
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 3
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 4
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%66 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 5
%67 = load i32, i32* %66
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %67)
%69 = call i32 @putchar(i32 10)
ret void
}