#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*/ euleriano(int *, int *, int, int);
int /*<<< orphan*/ limpa();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
void submenu(int *vert, int *adj, int cont, int cont2) {
  int opcao, i, j, k = 0;
  puts("Digite 1 para mostrar o grafo\n");
  puts("Digite 2 para encontrar um caminho euleriano\n");
  puts("Digite 0 para retornar ao menu anterior\n");
  printf("::>");
  scanf("%i", &opcao);
  if (opcao == 1) {
    for (i = 0; i < cont; i++) {
      printf("Indice:%i Grau: %i Vizinhos: ", i + 1, vert[i]);
      for (j = 0; j < vert[i]; j++) {
        printf("%i ", adj[k]);
        k++;
      }
      puts("\n");
    }
  }
  if (opcao == 2) {
    euleriano(vert, adj, cont, cont2);
  }
  if (opcao == 0) {
    limpa();
    return;
  }
}


x86 assembly (clang, -O0):
<submenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    1255 <submenu+0x105>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1250 <submenu+0x100>
mov    -0x20(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1236 <submenu+0xe6>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f2 <submenu+0xa2>
lea    0xde0(%rip),%rdi
call   1030 <puts@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11c0 <submenu+0x70>
jmp    1255 <submenu+0x105>
cmpl   $0x2,-0x1c(%rbp)
jne    1272 <submenu+0x122>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1070 <euleriano@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    1283 <submenu+0x133>
mov    $0x0,%al
call   1050 <limpa@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<submenu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %rsi,0x18(%rsp)
mov    %rdi,%rbp
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x1,%eax
jne    1273 <submenu+0x123>
test   %ebx,%ebx
jle    1299 <submenu+0x149>
mov    %r14d,0x10(%rsp)
mov    %ebx,0xc(%rsp)
mov    %ebx,%eax
mov    %rax,0x20(%rsp)
lea    0xec1(%rip),%rbx
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    1206 <submenu+0xb6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%r15
cmp    0x20(%rsp),%r14
je     1266 <submenu+0x116>
lea    0x1(%r15),%r14
mov    0x0(%rbp,%r15,4),%edx
lea    0xe67(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x0(%rbp,%r15,4)
jle    11f0 <submenu+0xa0>
mov    %r12d,0x14(%rsp)
movslq %r12d,%rax
mov    0x18(%rsp),%rcx
lea    (%rcx,%rax,4),%r13
xor    %r12d,%r12d
nopl   0x0(%rax)
mov    0x0(%r13,%r12,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r12
cmp    0x0(%rbp,%r15,4),%r12d
jl     1240 <submenu+0xf0>
mov    0x14(%rsp),%eax
add    %r12d,%eax
mov    %eax,%r12d
jmp    11f0 <submenu+0xa0>
mov    0x8(%rsp),%eax
mov    0x10(%rsp),%r14d
mov    0xc(%rsp),%ebx
cmp    $0x2,%eax
jne    128e <submenu+0x13e>
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1070 <euleriano@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jne    1299 <submenu+0x149>
xor    %eax,%eax
call   1050 <limpa@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Digite 1 para mostrar o grafo\0A\00"
@.str.1 = [46 x i8] c"Digite 2 para encontrar um caminho euleriano\0A\00"
@.str.2 = [41 x i8] c"Digite 0 para retornar ao menu anterior\0A\00"
@.str.3 = [4 x i8] c"::>\00"
@.str.4 = [3 x i8] c"%i\00"
@.str.5 = [30 x i8] c"Indice:%i Grau: %i Vizinhos: \00"
@.str.6 = [4 x i8] c"%i \00"
@.str.7 = [2 x i8] c"\0A\00"
define void @submenu(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %12
%13 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @puts(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %9)
%18 = load i32, i32* %9
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %60
20: ; preds = %4
store i32 0, i32* %10
br label %21
21: ; preds = %56, %20
%22 = load i32, i32* %10
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %59
25: ; preds = %21
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
%28 = load i32*, i32** %5
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %27, i32 %32)
store i32 0, i32* %11
br label %34
34: ; preds = %51, %25
%35 = load i32, i32* %11
%36 = load i32*, i32** %5
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
%40 = load i32, i32* %39
%41 = icmp slt i32 %35, %40
br i1 %41, label %42, label %54
42: ; preds = %34
%43 = load i32*, i32** %6
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %12
%50 = add nsw i32 %49, 1
store i32 %50, i32* %12
br label %51
51: ; preds = %42
%52 = load i32, i32* %11
%53 = add nsw i32 %52, 1
store i32 %53, i32* %11
br label %34
54: ; preds = %34
%55 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %10
%58 = add nsw i32 %57, 1
store i32 %58, i32* %10
br label %21
59: ; preds = %21
br label %60
60: ; preds = %59, %4
%61 = load i32, i32* %9
%62 = icmp eq i32 %61, 2
br i1 %62, label %63, label %69
63: ; preds = %60
%64 = load i32*, i32** %5
%65 = load i32*, i32** %6
%66 = load i32, i32* %7
%67 = load i32, i32* %8
%68 = call i32 @euleriano(i32* %64, i32* %65, i32 %66, i32 %67)
br label %69
69: ; preds = %63, %60
%70 = load i32, i32* %9
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %69
%73 = call i32 (...) @limpa()
br label %74
74: ; preds = %72, %69
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Digite 1 para mostrar o grafo\0A\00"
@.str.1 = [46 x i8] c"Digite 2 para encontrar um caminho euleriano\0A\00"
@.str.2 = [41 x i8] c"Digite 0 para retornar ao menu anterior\0A\00"
@.str.3 = [4 x i8] c"::>\00"
@.str.4 = [3 x i8] c"%i\00"
@.str.5 = [30 x i8] c"Indice:%i Grau: %i Vizinhos: \00"
@.str.6 = [4 x i8] c"%i \00"
@.str.7 = [2 x i8] c"\0A\00"
define void @submenu(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %48
14: ; preds = %4
%15 = icmp sgt i32 %2, 0
br i1 %15, label %16, label %59
16: ; preds = %14
%17 = zext i32 %2 to i64
br label %18
18: ; preds = %16, %42
%19 = phi i64 [ 0, %16 ], [ %21, %42 ]
%20 = phi i32 [ 0, %16 ], [ %43, %42 ]
%21 = add nuw nsw i64 %19, 1
%22 = getelementptr inbounds i32, i32* %0, i64 %19
%23 = load i32, i32* %22
%24 = trunc i64 %21 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %24, i32 %23)
%26 = load i32, i32* %22
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %42
28: ; preds = %18
%29 = sext i32 %20 to i64
br label %30
30: ; preds = %28, %30
%31 = phi i64 [ %29, %28 ], [ %36, %30 ]
%32 = phi i32 [ 0, %28 ], [ %37, %30 ]
%33 = getelementptr inbounds i32, i32* %1, i64 %31
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %34)
%36 = add nsw i64 %31, 1
%37 = add nuw nsw i32 %32, 1
%38 = load i32, i32* %22
%39 = icmp slt i32 %37, %38
br i1 %39, label %30, label %40
40: ; preds = %30
%41 = trunc i64 %36 to i32
br label %42
42: ; preds = %40, %18
%43 = phi i32 [ %20, %18 ], [ %41, %40 ]
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%45 = icmp eq i64 %21, %17
br i1 %45, label %46, label %18
46: ; preds = %42
%47 = load i32, i32* %5
br label %48
48: ; preds = %46, %4
%49 = phi i32 [ %12, %4 ], [ %47, %46 ]
%50 = icmp eq i32 %49, 2
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = call i32 @euleriano(i32* %0, i32* %1, i32 %2, i32 %3)
%53 = load i32, i32* %5
br label %54
54: ; preds = %51, %48
%55 = phi i32 [ %53, %51 ], [ %49, %48 ]
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 (...) @limpa()
br label %59
59: ; preds = %14, %54, %57
ret void
}