#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 vertice {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ conecta(struct vertice **, int, int);
int /*<<< orphan*/ imprime(struct vertice **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  struct vertice *grafo = NULL;
  int v, a;
  do {
    printf("\nPara encerrar digite 0 para o vertice e o adjacente\n");
    printf("Digite o Vertice: ");
    scanf("%i", &v);
    printf("Digite o Adjacente: ");
    scanf("%i", &a);
    if ((v != 0) && (a != 0)) {
      conecta(&grafo, v, a);
      imprime(&grafo);
    }
  } while ((v != 0) && (a != 0));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11c7 <main+0x87>
cmpl   $0x0,-0x18(%rbp)
je     11c7 <main+0x87>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    -0x10(%rbp),%rdi
call   1060 <conecta@plt>
lea    -0x10(%rbp),%rdi
call   1040 <imprime@plt>
jmp    11cc <main+0x8c>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x19(%rbp)
je     11e5 <main+0xa5>
cmpl   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1157 <main+0x17>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
lea    0xe92(%rip),%r15
lea    0xe9e(%rip),%rbx
lea    0xc(%rsp),%r12
lea    0xe95(%rip),%r13
lea    0x8(%rsp),%rbp
lea    0x10(%rsp),%r14
nopl   0x0(%rax,%rax,1)
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
test   %esi,%esi
je     11ea <main+0x9a>
test   %edx,%edx
je     11ea <main+0x9a>
mov    %r14,%rdi
call   1070 <conecta@plt>
mov    %r14,%rdi
call   1050 <imprime@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
test   %esi,%esi
je     11f2 <main+0xa2>
test   %edx,%edx
jne    1190 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.vertice = type { i32 }
@.str = [54 x i8] c"\0APara encerrar digite 0 para o vertice e o adjacente\0A\00"
@.str.1 = [19 x i8] c"Digite o Vertice: \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [21 x i8] c"Digite o Adjacente: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.vertice*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store %struct.vertice* null, %struct.vertice** %2
br label %5
5: ; preds = %28, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i32 @conecta(%struct.vertice** %2, i32 %17, i32 %18)
%20 = call i32 @imprime(%struct.vertice** %2)
br label %21
21: ; preds = %16, %13, %5
br label %22
22: ; preds = %21
%23 = load i32, i32* %3
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 0
br label %28
28: ; preds = %25, %22
%29 = phi i1 [ false, %22 ], [ %27, %25 ]
br i1 %29, label %5, label %30
30: ; preds = %28
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
%struct.vertice = type { i32 }
@.str.1 = [19 x i8] c"Digite o Vertice: \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [21 x i8] c"Digite o Adjacente: \00"
@str = [53 x i8] c"\0APara encerrar digite 0 para o vertice e o adjacente\00"
define i32 @main() {
%1 = alloca %struct.vertice*
%2 = alloca i32
%3 = alloca i32
%4 = bitcast %struct.vertice** %1 to i8*
store %struct.vertice* null, %struct.vertice** %1
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %23, %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
%15 = load i32, i32* %3
%16 = icmp ne i32 %15, 0
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %18, label %23
18: ; preds = %7
%19 = call i32 @conecta(%struct.vertice** %1, i32 %13, i32 %15)
%20 = call i32 @imprime(%struct.vertice** %1)
%21 = load i32, i32* %2
%22 = load i32, i32* %3
br label %23
23: ; preds = %7, %18
%24 = phi i32 [ %15, %7 ], [ %22, %18 ]
%25 = phi i32 [ %13, %7 ], [ %21, %18 ]
%26 = icmp ne i32 %25, 0
%27 = icmp ne i32 %24, 0
%28 = select i1 %26, i1 %27, i1 false
br i1 %28, label %7, label %29
29: ; preds = %23
ret i32 0
}