#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 inputGraph(int g[5][5]) {
  printf("\n\tInputting Edges: \n");
  printf("\tHow many edges do you wish to add? ans = ");
  int numberOfEdges = 0;
  scanf("%d", &numberOfEdges);
  int i;
  int a, b;
  for (i = 0; i < numberOfEdges; i++) {
    printf("\t%d.\n\tNode 1: ", i);
    scanf("%d", &a);
    printf("\tNode 2: ");
    scanf("%d", &b);
    g[a][b] = 1;
    g[b][a] = 1;
    printf("\tEdge (%d,%d) added.\n\n", a, b);
  }
}


x86 assembly (clang, -O0):
<inputGraph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
lea    0xeea(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1207 <inputGraph+0xe7>
mov    -0x10(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1166 <inputGraph+0x46>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputGraph>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0xf16(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x0,0xc(%rsp)
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1210 <inputGraph+0xe0>
lea    0xea5(%rip),%r15
lea    0xeb0(%rip),%r13
lea    0x10(%rsp),%rbp
lea    0xeae(%rip),%r14
xor    %r12d,%r12d
nopl   0x0(%rax)
lea    0xe87(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
lea    0x14(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
movslq 0x14(%rsp),%rsi
movslq 0x10(%rsp),%rdx
lea    (%rsi,%rsi,4),%rax
lea    (%rbx,%rax,4),%rax
movl   $0x1,(%rax,%rdx,4)
lea    (%rdx,%rdx,4),%rax
lea    (%rbx,%rax,4),%rax
movl   $0x1,(%rax,%rsi,4)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
jl     11a0 <inputGraph+0x70>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0A\09Inputting Edges: \0A\00"
@.str.1 = [43 x i8] c"\09How many edges do you wish to add? ans = \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [15 x i8] c"\09%d.\0A\09Node 1: \00"
@.str.4 = [10 x i8] c"\09Node 2: \00"
@.str.5 = [23 x i8] c"\09Edge (%d,%d) added.\0A\0A\00"
define void @inputGraph([5 x i32]* %0) {
%2 = alloca [5 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [5 x i32]* %0, [5 x i32]** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
br label %10
10: ; preds = %37, %1
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %40
14: ; preds = %10
%15 = load i32, i32* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%20 = load [5 x i32]*, [5 x i32]** %2
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %20, i64 %22
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %23, i64 0, i64 %25
store i32 1, i32* %26
%27 = load [5 x i32]*, [5 x i32]** %2
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %27, i64 %29
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %30, i64 0, i64 %32
store i32 1, i32* %33
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %34, i32 %35)
br label %37
37: ; preds = %14
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %10
40: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str.1 = [43 x i8] c"\09How many edges do you wish to add? ans = \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [15 x i8] c"\09%d.\0A\09Node 1: \00"
@.str.4 = [10 x i8] c"\09Node 2: \00"
@.str.5 = [23 x i8] c"\09Edge (%d,%d) added.\0A\0A\00"
@str = [20 x i8] c"\0A\09Inputting Edges: \00"
define void @inputGraph([5 x i32]* nocapture writeonly %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%7 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %29
13: ; preds = %1, %13
%14 = phi i32 [ %26, %13 ], [ 0, %1 ]
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %20, i64 %22
store i32 1, i32* %23
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %22, i64 %20
store i32 1, i32* %24
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %19, i32 %21)
%26 = add nuw nsw i32 %14, 1
%27 = load i32, i32* %2
%28 = icmp slt i32 %26, %27
br i1 %28, label %13, label %29
29: ; preds = %13, %1
ret void
}