#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
void create_graph(int G[][20], int no_of_nodes) {
  int i, j;
  int no_of_edges;
  int v1, v2, weight;
  for (i = 0; i < no_of_nodes; i++)
    for (j = 0; j < no_of_nodes; j++)
      G[i][j] = 0;
  printf("\n Enter the number of edges");
  scanf("%d", &no_of_edges);
  printf("Enter the edges as (v1,v2,weight)triplets\n");
  for (i = 0; i < no_of_edges; i++) {
    scanf("%d%d%d", &v1, &v2, &weight);
    G[v1][v2] = G[v2][v1] = weight;
  }
}


x86 assembly (clang, -O0):
<create_graph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1190 <create_graph+0x70>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117d <create_graph+0x5d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <create_graph+0x29>
jmp    1182 <create_graph+0x62>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <create_graph+0x16>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1224 <create_graph+0x104>
lea    0xe73(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x24(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c1 <create_graph+0xa1>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_graph>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
test   %esi,%esi
jle    1267 <create_graph+0x127>
mov    %esi,%r13d
lea    0x0(,%r13,4),%r15
lea    -0x1(%r13),%rax
mov    %r13d,%r12d
and    $0x7,%r12d
cmp    $0x7,%rax
jae    117c <create_graph+0x3c>
xor    %ebp,%ebp
jmp    1225 <create_graph+0xe5>
and    $0xfffffff8,%r13d
xor    %ebp,%ebp
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
lea    0x50(%rbx),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
lea    0xa0(%rbx),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
lea    0xf0(%rbx),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
lea    0x140(%rbx),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
lea    0x190(%rbx),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
lea    0x1e0(%rbx),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
lea    0x230(%rbx),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
add    $0x8,%rbp
add    $0x280,%rbx
cmp    %rbp,%r13
jne    1190 <create_graph+0x50>
test   %r12,%r12
je     1267 <create_graph+0x127>
lea    0x0(,%rbp,4),%r13
add    %rbp,%r13
shl    $0x4,%r13
add    %r14,%r13
shl    $0x4,%r12
lea    (%r12,%r12,4),%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
lea    (%rbx,%r13,1),%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1050 <memset@plt>
add    $0x50,%rbx
cmp    %rbx,%rbp
jne    1250 <create_graph+0x110>
lea    0xd92(%rip),%rdi
call   1040 <printf@plt>
lea    0xda6(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xd96(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    1306 <create_graph+0x1c6>
lea    0xd7c(%rip),%r15
lea    0x14(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
movslq 0x10(%rsp),%rcx
movslq 0x14(%rsp),%rdx
lea    (%rcx,%rcx,4),%rsi
shl    $0x4,%rsi
add    %r14,%rsi
mov    %eax,(%rsi,%rdx,4)
lea    (%rdx,%rdx,4),%rdx
shl    $0x4,%rdx
add    %r14,%rdx
mov    %eax,(%rdx,%rcx,4)
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jl     12c0 <create_graph+0x180>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\0A Enter the number of edges\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [43 x i8] c"Enter the edges as (v1,v2,weight)triplets\0A\00"
@.str.3 = [7 x i8] c"%d%d%d\00"
define void @create_graph([20 x i32]* %0, i32 %1) {
%3 = alloca [20 x i32]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store [20 x i32]* %0, [20 x i32]** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %11
11: ; preds = %32, %2
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %35
15: ; preds = %11
store i32 0, i32* %6
br label %16
16: ; preds = %28, %15
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load [20 x i32]*, [20 x i32]** %3
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [20 x i32], [20 x i32]* %21, i64 %23
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [20 x i32], [20 x i32]* %24, i64 0, i64 %26
store i32 0, i32* %27
br label %28
28: ; preds = %20
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %16
31: ; preds = %16
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %11
35: ; preds = %11
%36 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%37 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%38 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %39
39: ; preds = %60, %35
%40 = load i32, i32* %5
%41 = load i32, i32* %7
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %63
43: ; preds = %39
%44 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %8, i32* %9, i32* %10)
%45 = load i32, i32* %10
%46 = load [20 x i32]*, [20 x i32]** %3
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %46, i64 %48
%50 = load i32, i32* %8
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [20 x i32], [20 x i32]* %49, i64 0, i64 %51
store i32 %45, i32* %52
%53 = load [20 x i32]*, [20 x i32]** %3
%54 = load i32, i32* %8
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [20 x i32], [20 x i32]* %53, i64 %55
%57 = load i32, i32* %9
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [20 x i32], [20 x i32]* %56, i64 0, i64 %58
store i32 %45, i32* %59
br label %60
60: ; preds = %43
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %39
63: ; preds = %39
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"\0A Enter the number of edges\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [7 x i8] c"%d%d%d\00"
@str = [42 x i8] c"Enter the edges as (v1,v2,weight)triplets\00"
define void @create_graph([20 x i32]* nocapture writeonly %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp sgt i32 %1, 0
br i1 %11, label %12, label %60
12: ; preds = %2
%13 = zext i32 %1 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nsw i64 %13, -1
%16 = and i64 %13, 7
%17 = icmp ult i64 %15, 7
br i1 %17, label %49, label %18
18: ; preds = %12
%19 = and i64 %13, 4294967288
br label %20
20: ; preds = %20, %18
%21 = phi i64 [ 0, %18 ], [ %46, %20 ]
%22 = phi i64 [ 0, %18 ], [ %47, %20 ]
%23 = getelementptr [20 x i32], [20 x i32]* %0, i64 %21, i64 0
%24 = bitcast i32* %23 to i8*
%25 = or i64 %21, 1
%26 = getelementptr [20 x i32], [20 x i32]* %0, i64 %25, i64 0
%27 = bitcast i32* %26 to i8*
%28 = or i64 %21, 2
%29 = getelementptr [20 x i32], [20 x i32]* %0, i64 %28, i64 0
%30 = bitcast i32* %29 to i8*
%31 = or i64 %21, 3
%32 = getelementptr [20 x i32], [20 x i32]* %0, i64 %31, i64 0
%33 = bitcast i32* %32 to i8*
%34 = or i64 %21, 4
%35 = getelementptr [20 x i32], [20 x i32]* %0, i64 %34, i64 0
%36 = bitcast i32* %35 to i8*
%37 = or i64 %21, 5
%38 = getelementptr [20 x i32], [20 x i32]* %0, i64 %37, i64 0
%39 = bitcast i32* %38 to i8*
%40 = or i64 %21, 6
%41 = getelementptr [20 x i32], [20 x i32]* %0, i64 %40, i64 0
%42 = bitcast i32* %41 to i8*
%43 = or i64 %21, 7
%44 = getelementptr [20 x i32], [20 x i32]* %0, i64 %43, i64 0
%45 = bitcast i32* %44 to i8*
%46 = add nuw nsw i64 %21, 8
%47 = add i64 %22, 8
%48 = icmp eq i64 %47, %19
br i1 %48, label %49, label %20
49: ; preds = %20, %12
%50 = phi i64 [ 0, %12 ], [ %46, %20 ]
%51 = icmp eq i64 %16, 0
br i1 %51, label %60, label %52
52: ; preds = %49, %52
%53 = phi i64 [ %57, %52 ], [ %50, %49 ]
%54 = phi i64 [ %58, %52 ], [ 0, %49 ]
%55 = getelementptr [20 x i32], [20 x i32]* %0, i64 %53, i64 0
%56 = bitcast i32* %55 to i8*
%57 = add nuw nsw i64 %53, 1
%58 = add i64 %54, 1
%59 = icmp eq i64 %58, %16
br i1 %59, label %60, label %52
60: ; preds = %49, %52, %2
%61 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%62 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%64 = load i32, i32* %3
%65 = icmp sgt i32 %64, 0
br i1 %65, label %66, label %79
66: ; preds = %60, %66
%67 = phi i32 [ %76, %66 ], [ 0, %60 ]
%68 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%69 = load i32, i32* %6
%70 = load i32, i32* %5
%71 = sext i32 %70 to i64
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %71, i64 %73
store i32 %69, i32* %74
%75 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %73, i64 %71
store i32 %69, i32* %75
%76 = add nuw nsw i32 %67, 1
%77 = load i32, i32* %3
%78 = icmp slt i32 %76, %77
br i1 %78, label %66, label %79
79: ; preds = %66, %60
ret void
}