#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*/ prims(int **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num_nodes, adjacency[20][20];
  printf("Number of nodes : ");
  scanf("%d", &num_nodes);
  for (int i = 0; i < num_nodes; i++)
    for (int j = 0; j < num_nodes; j++)
      scanf("%d", &adjacency[i][j]);
  prims(adjacency, num_nodes);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x660,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x654(%rbp)
mov    -0x654(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ec <main+0xbc>
movl   $0x0,-0x658(%rbp)
mov    -0x658(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d3 <main+0xa3>
movslq -0x654(%rbp),%rax
lea    -0x650(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
movslq -0x658(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe59(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x658(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x658(%rbp)
jmp    1181 <main+0x51>
jmp    11d8 <main+0xa8>
mov    -0x654(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x654(%rbp)
jmp    1168 <main+0x38>
lea    -0x650(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <prims@plt>
xor    %eax,%eax
add    $0x660,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x650,%rsp
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11bf <main+0x8f>
lea    0x10(%rsp),%r15
xor    %r12d,%r12d
lea    0xe9f(%rip),%r14
jmp    1190 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
movslq %esi,%rax
add    $0x1,%r12
add    $0x50,%r15
cmp    %rax,%r12
jge    11bf <main+0x8f>
test   %esi,%esi
jle    1180 <main+0x50>
mov    %r15,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
add    $0x4,%r13
cmp    %rsi,%rbx
jl     11a0 <main+0x70>
jmp    1180 <main+0x50>
lea    0x10(%rsp),%rdi
call   1050 <prims@plt>
xor    %eax,%eax
add    $0x650,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Number of nodes : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x [20 x i32]]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %4
br label %8
8: ; preds = %29, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %8
store i32 0, i32* %5
br label %13
13: ; preds = %25, %12
%14 = load i32, i32* %5
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %3, i64 0, i64 %19
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %20, i64 0, i64 %22
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %13
28: ; preds = %13
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %8
32: ; preds = %8
%33 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %3, i64 0, i64 0
%34 = bitcast [20 x i32]* %33 to i32**
%35 = load i32, i32* %2
%36 = call i32 @prims(i32** %34, i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Number of nodes : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x [20 x i32]]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [20 x [20 x i32]]* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0, %17
%10 = phi i32 [ %18, %17 ], [ %7, %0 ]
%11 = phi i64 [ %20, %17 ], [ 0, %0 ]
%12 = icmp sgt i32 %10, 0
br i1 %12, label %22, label %17
13: ; preds = %17, %0
%14 = phi i32 [ %7, %0 ], [ %18, %17 ]
%15 = bitcast [20 x [20 x i32]]* %2 to i32**
%16 = call i32 @prims(i32** %15, i32 %14)
ret i32 0
17: ; preds = %22, %9
%18 = phi i32 [ %10, %9 ], [ %27, %22 ]
%19 = sext i32 %18 to i64
%20 = add nuw nsw i64 %11, 1
%21 = icmp slt i64 %20, %19
br i1 %21, label %9, label %13
22: ; preds = %9, %22
%23 = phi i64 [ %26, %22 ], [ 0, %9 ]
%24 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %2, i64 0, i64 %11, i64 %23
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
%26 = add nuw nsw i64 %23, 1
%27 = load i32, i32* %1
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %26, %28
br i1 %29, label %22, label %17
}