#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 /*<<< orphan*/ system(char *);
void inputGraph(int g[10][10]) {
  printf("\n\tInputting Edges: \n");
  printf("\tHow many edges do you wish to add? ans = ");
  int numberOfEdges = 0;
  scanf("%d", &numberOfEdges);
  int i;
  char a, b;
  for (i = 0; i < numberOfEdges; i++) {
    printf("\t%d.\n\tNode 1: ", i + 1);
    scanf("%d", &a);
    system("pause");
    printf("\tNode 2: ");
    scanf("%d", &b);
    system("pause");
    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    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
lea    0xeda(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    123e <inputGraph+0x10e>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xea1(%rip),%rdi
call   1030 <system@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0x12(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe75(%rip),%rdi
call   1030 <system@plt>
mov    -0x8(%rbp),%rax
movsbq -0x11(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movsbq -0x12(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movsbq -0x12(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movsbq -0x11(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
movsbl -0x11(%rbp),%esi
movsbl -0x12(%rbp),%edx
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1178 <inputGraph+0x48>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputGraph>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x0,0x4(%rsp)
lea    0xeb4(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    123f <inputGraph+0xff>
lea    0xe96(%rip),%r15
lea    0xea1(%rip),%r13
lea    0x2(%rsp),%r14
lea    0xea5(%rip),%r12
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
lea    0xe74(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r13,%rdi
call   1040 <system@plt>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r13,%rdi
call   1040 <system@plt>
movsbl 0x3(%rsp),%eax
movslq %eax,%rsi
movsbl 0x2(%rsp),%eax
movslq %eax,%rdx
lea    (%rsi,%rsi,4),%rax
lea    (%rbx,%rax,8),%rax
movl   $0x1,(%rax,%rdx,4)
lea    (%rdx,%rdx,4),%rax
lea    (%rbx,%rax,8),%rax
movl   $0x1,(%rax,%rsi,4)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    0x4(%rsp),%ebp
jl     11b0 <inputGraph+0x70>
add    $0x8,%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 = [6 x i8] c"pause\00"
@.str.5 = [10 x i8] c"\09Node 2: \00"
@.str.6 = [23 x i8] c"\09Edge (%d,%d) added.\0A\0A\00"
define void @inputGraph([10 x i32]* %0) {
%2 = alloca [10 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
store [10 x i32]* %0, [10 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 (i8*, ...) @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 = %42, %1
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %45
14: ; preds = %10
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%19 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%23 = load [10 x i32]*, [10 x i32]** %2
%24 = load i8, i8* %5
%25 = sext i8 %24 to i64
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %23, i64 %25
%27 = load i8, i8* %6
%28 = sext i8 %27 to i64
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %26, i64 0, i64 %28
store i32 1, i32* %29
%30 = load [10 x i32]*, [10 x i32]** %2
%31 = load i8, i8* %6
%32 = sext i8 %31 to i64
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %30, i64 %32
%34 = load i8, i8* %5
%35 = sext i8 %34 to i64
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %33, i64 0, i64 %35
store i32 1, i32* %36
%37 = load i8, i8* %5
%38 = sext i8 %37 to i32
%39 = load i8, i8* %6
%40 = sext i8 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %38, i32 %40)
br label %42
42: ; preds = %14
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %10
45: ; 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 = [6 x i8] c"pause\00"
@.str.5 = [10 x i8] c"\09Node 2: \00"
@.str.6 = [23 x i8] c"\09Edge (%d,%d) added.\0A\0A\00"
@str = [20 x i8] c"\0A\09Inputting Edges: \00"
define void @inputGraph([10 x i32]* nocapture writeonly %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
%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 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %1, %11
%12 = phi i32 [ %13, %11 ], [ 0, %1 ]
%13 = add nuw nsw i32 %12, 1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%19 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%20 = load i8, i8* %3
%21 = sext i8 %20 to i64
%22 = load i8, i8* %4
%23 = sext i8 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %21, i64 %23
store i32 1, i32* %24
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %23, i64 %21
store i32 1, i32* %25
%26 = sext i8 %20 to i32
%27 = sext i8 %22 to i32
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %26, i32 %27)
%29 = load i32, i32* %2
%30 = icmp slt i32 %13, %29
br i1 %30, label %11, label %31
31: ; preds = %11, %1
ret void
}