#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 EXIT_SUCCESS;
int /*<<< orphan*/ eliminarProducto(char *, char *);
int /*<<< orphan*/ introducirProductos(char *);
int /*<<< orphan*/ mostrarMenu();
int /*<<< orphan*/ mostrarProductos(char *);
char *obtenerCodigo();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  printf("***MANEJO DE INVENTARIO***\n");
  introducirProductos("Inventario");
  while (1) {
    int opcion;
    mostrarMenu();
    scanf("%i", &opcion);
    if (opcion == 1) {
      mostrarProductos("Inventario");
    }
    if (opcion == 2) {
      char *codigo;
      codigo = obtenerCodigo();
      eliminarProducto(codigo, "Inventario");
    }
    if (opcion == 3) {
      printf("GRACIAS!!!");
      return (EXIT_SUCCESS);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
lea    0xe83(%rip),%rdi
call   1070 <introducirProductos@plt>
mov    $0x0,%al
call   1030 <mostrarMenu@plt>
lea    0xe7b(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1080 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11cb <main+0x5b>
lea    0xe56(%rip),%rdi
call   1060 <mostrarProductos@plt>
cmpl   $0x2,-0x14(%rbp)
jne    11f0 <main+0x80>
mov    $0x0,%al
call   1090 <obtenerCodigo@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1050 <eliminarProducto@plt>
cmpl   $0x3,-0x14(%rbp)
jne    1215 <main+0xa5>
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    119e <main+0x2e>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe89(%rip),%rdi
call   1040 <puts@plt>
lea    0xe64(%rip),%r14
mov    %r14,%rdi
call   1080 <introducirProductos@plt>
lea    0xe60(%rip),%r15
lea    0xc(%rsp),%rbx
jmp    11c5 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x3,%eax
je     1219 <main+0x99>
xor    %eax,%eax
call   1030 <mostrarMenu@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     11f0 <main+0x70>
cmp    $0x2,%eax
jne    11c0 <main+0x40>
jmp    1201 <main+0x81>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1070 <mostrarProductos@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
jne    11c0 <main+0x40>
xor    %eax,%eax
call   10a0 <obtenerCodigo@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1060 <eliminarProducto@plt>
mov    0xc(%rsp),%eax
jmp    11c0 <main+0x40>
lea    0xdee(%rip),%rdi
call   1050 <printf@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"***MANEJO DE INVENTARIO***\0A\00"
@.str.1 = [11 x i8] c"Inventario\00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [11 x i8] c"GRACIAS!!!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @introducirProductos(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %2, %30
%11 = call i32 (...) @mostrarMenu()
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 @mostrarProductos(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %10
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = call i8* (...) @obtenerCodigo()
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i32 @eliminarProducto(i8* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %20, %17
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 3
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
30: ; preds = %24
br label %10
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"Inventario\00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [11 x i8] c"GRACIAS!!!\00"
@EXIT_SUCCESS = global i32 0
@str = [27 x i8] c"***MANEJO DE INVENTARIO***\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @introducirProductos(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %25, %2
%8 = call i32 (...) @mostrarMenu()
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = call i32 @mostrarProductos(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %3
br label %15
15: ; preds = %12, %7
%16 = phi i32 [ %14, %12 ], [ %10, %7 ]
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = call i8* (...) @obtenerCodigo()
%20 = call i32 @eliminarProducto(i8* %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* %3
br label %22
22: ; preds = %18, %15
%23 = phi i32 [ %21, %18 ], [ %16, %15 ]
%24 = icmp eq i32 %23, 3
br i1 %24, label %26, label %25
25: ; preds = %22
br label %7
26: ; preds = %22
%27 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
}