#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 */
struct gnode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ createGraph(struct gnode **, int);
int /*<<< orphan*/ deleteGraph(struct gnode **, int);
int /*<<< orphan*/ inputGraph(struct gnode **, int);
int /*<<< orphan*/ minimumSpanningTreePrim(struct gnode **, int);
int /*<<< orphan*/ printGraph(struct gnode **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  struct gnode *adj[(50)];
  int num;
  printf("\nEnter no. of nodes in weighted graph: ");
  scanf("%d", &num);
  num -= 1;
  createGraph(adj, num);
  inputGraph(adj, num);
  printGraph(adj, num);
  minimumSpanningTreePrim(adj, num);
  deleteGraph(adj, num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x1a4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
call   1050 <createGraph@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
call   1040 <inputGraph@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
call   1090 <printGraph@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
call   1070 <minimumSpanningTreePrim@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
call   1080 <deleteGraph@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1a0,%rsp
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
add    $0xffffffff,%esi
mov    %esi,0xc(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <createGraph@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <inputGraph@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1090 <printGraph@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1070 <minimumSpanningTreePrim@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1080 <deleteGraph@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.gnode = type { i32 }
@.str = [40 x i8] c"\0AEnter no. of nodes in weighted graph: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x %struct.gnode*]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = sub nsw i32 %6, 1
store i32 %7, i32* %3
%8 = getelementptr inbounds [50 x %struct.gnode*], [50 x %struct.gnode*]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @createGraph(%struct.gnode** %8, i32 %9)
%11 = getelementptr inbounds [50 x %struct.gnode*], [50 x %struct.gnode*]* %2, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 @inputGraph(%struct.gnode** %11, i32 %12)
%14 = getelementptr inbounds [50 x %struct.gnode*], [50 x %struct.gnode*]* %2, i64 0, i64 0
%15 = load i32, i32* %3
%16 = call i32 @printGraph(%struct.gnode** %14, i32 %15)
%17 = getelementptr inbounds [50 x %struct.gnode*], [50 x %struct.gnode*]* %2, i64 0, i64 0
%18 = load i32, i32* %3
%19 = call i32 @minimumSpanningTreePrim(%struct.gnode** %17, i32 %18)
%20 = getelementptr inbounds [50 x %struct.gnode*], [50 x %struct.gnode*]* %2, i64 0, i64 0
%21 = load i32, i32* %3
%22 = call i32 @deleteGraph(%struct.gnode** %20, i32 %21)
ret i32 0
}

LLVM IR (-O2):
%struct.gnode = type { i32 }
@.str = [40 x i8] c"\0AEnter no. of nodes in weighted graph: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [50 x %struct.gnode*]
%2 = alloca i32
%3 = bitcast [50 x %struct.gnode*]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 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* %2)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, -1
store i32 %8, i32* %2
%9 = getelementptr inbounds [50 x %struct.gnode*], [50 x %struct.gnode*]* %1, i64 0, i64 0
%10 = call i32 @createGraph(%struct.gnode** %9, i32 %8)
%11 = load i32, i32* %2
%12 = call i32 @inputGraph(%struct.gnode** %9, i32 %11)
%13 = load i32, i32* %2
%14 = call i32 @printGraph(%struct.gnode** %9, i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @minimumSpanningTreePrim(%struct.gnode** %9, i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @deleteGraph(%struct.gnode** %9, i32 %17)
ret i32 0
}