#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*/ bajio(int, int);
int /*<<< orphan*/ clear();
int /*<<< orphan*/ consultab(int, int);
int /*<<< orphan*/ consultaf(float, int);
int /*<<< orphan*/ consultag(int);
int /*<<< orphan*/ consultan(char *, int);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ getstr(char *);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ printw(char *);
int registro();
int /*<<< orphan*/ scanw(char *, int *);
float ventas(int, int, char *, int *, int);
int main() {
  int op = 0, cont = 0, ch = 0, cant = 0, regcont = 0;
  char name[50];
  float vt = 0.0;
  initscr();
  do {
    clear();
    printw("MENU\n\n\t1) Registro De Articulos\n\t2) Consulta General\n\t3) "
           "Consulta Por Articulo\n\t4) Bajas\n\t5) Ventas\n\t6) Consulta de "
           "Facturas\n\t7) Consulta Por Nombre\n\t8) Salir\n\nIntroduce tu "
           "Eleccion:\n>>");
    scanw("%d", &op);
    switch (op) {
    case 1:
      cont = registro();
      break;
    case 2:
      consultag(cont);
      break;
    case 3:
      printw("Introdusca el Codigo de Barras del articulo:\n>>");
      scanw("%d", &ch);
      consultab(ch, cont);
      break;
    case 4:
      printw("Introdusca el Codigo de Barras del articulo:\n>>");
      scanw("%d", &ch);
      bajio(ch, cont);
      break;
    case 5:
      printw("Introdusca el Nombre del cliente:\n>>");
      getstr(name);
      printw("\nIntrodusca el Codigo de Barras del articulo:\n>>");
      scanw("%d", &ch);
      printw("\nIntrodusca la cantidad a comprar:\n>>");
      scanw("%d", &cant);
      vt += ventas(ch, cant, name, &regcont, cont);
      break;
    case 6:
      consultaf(vt, regcont);
      break;
    case 7:
      printw("Introdusca el Nombre del cliente a buscar:\n>>");
      getstr(name);
      consultan(name, regcont);
      break;
    case 8:
      clear();
      printw("Gracias por usar el programa, Vuelva pronto.\n\n");
      printw("[PRESIONE UNA TECLA]");
      getch();
      break;
    }
  } while (op != 8);
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
xor    %eax,%eax
call   1100 <clear@plt>
lea    0xdf1(%rip),%rdi
call   10a0 <printw@plt>
lea    0xe9f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   10f0 <scanw@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x60(%rbp)
sub    $0x7,%eax
ja     13b2 <main+0x1d2>
mov    -0x60(%rbp),%rax
lea    0xd9c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <registro@plt>
mov    %eax,-0xc(%rbp)
jmp    13b2 <main+0x1d2>
mov    -0xc(%rbp),%edi
call   10e0 <consultag@plt>
jmp    13b2 <main+0x1d2>
lea    0xe73(%rip),%rdi
call   10a0 <printw@plt>
lea    0xe3e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10f0 <scanw@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <consultab@plt>
jmp    13b2 <main+0x1d2>
lea    0xe47(%rip),%rdi
call   10a0 <printw@plt>
lea    0xe12(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10f0 <scanw@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <bajio@plt>
jmp    13b2 <main+0x1d2>
lea    0xdf5(%rip),%rdi
call   10a0 <printw@plt>
lea    -0x50(%rbp),%rdi
call   1090 <getstr@plt>
lea    0xe05(%rip),%rdi
call   10a0 <printw@plt>
lea    0xdd1(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10f0 <scanw@plt>
lea    0xe1a(%rip),%rdi
call   10a0 <printw@plt>
lea    0xdb5(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   10f0 <scanw@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0x50(%rbp),%rdx
mov    -0xc(%rbp),%r8d
lea    -0x18(%rbp),%rcx
call   10b0 <ventas@plt>
addss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
jmp    13b2 <main+0x1d2>
movss  -0x54(%rbp),%xmm0
mov    -0x18(%rbp),%edi
call   1080 <consultaf@plt>
jmp    13b2 <main+0x1d2>
lea    0xdec(%rip),%rdi
call   10a0 <printw@plt>
lea    -0x50(%rbp),%rdi
call   1090 <getstr@plt>
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1070 <consultan@plt>
jmp    13b2 <main+0x1d2>
mov    $0x0,%al
call   1100 <clear@plt>
lea    0xded(%rip),%rdi
call   10a0 <printw@plt>
lea    0xe10(%rip),%rdi
call   10a0 <printw@plt>
mov    $0x0,%al
call   10c0 <getch@plt>
jmp    13b7 <main+0x1d7>
cmpl   $0x8,-0x8(%rbp)
jne    1221 <main+0x41>
mov    $0x0,%al
call   10d0 <endwin@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movl   $0x0,0x18(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x14(%rsp)
xor    %eax,%eax
call   1040 <initscr@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
lea    0xdfb(%rip),%r14
lea    0xeae(%rip),%rbx
lea    0x18(%rsp),%r15
lea    0xdc8(%rip),%r13
lea    0x20(%rsp),%rbp
xor    %r12d,%r12d
jmp    127d <main+0x9d>
xor    %eax,%eax
call   1100 <clear@plt>
lea    0xf37(%rip),%rdi
call   10a0 <printw@plt>
lea    0xf5a(%rip),%rdi
call   10a0 <printw@plt>
xor    %eax,%eax
call   10c0 <getch@plt>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%eax
cmp    $0x8,%eax
je     13c0 <main+0x1e0>
xor    %eax,%eax
call   1100 <clear@plt>
mov    %r14,%rdi
call   10a0 <printw@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10f0 <scanw@plt>
mov    0x18(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x7,%ecx
ja     1274 <main+0x94>
movslq 0x0(%r13,%rcx,4),%rax
add    %r13,%rax
jmp    *%rax
xor    %eax,%eax
call   1030 <registro@plt>
mov    %eax,%r12d
jmp    1270 <main+0x90>
mov    %r12d,%edi
call   10e0 <consultag@plt>
jmp    1270 <main+0x90>
lea    0xe39(%rip),%rdi
call   10a0 <printw@plt>
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
call   10f0 <scanw@plt>
mov    0xc(%rsp),%edi
mov    %r12d,%esi
call   1060 <consultab@plt>
jmp    1270 <main+0x90>
lea    0xe12(%rip),%rdi
call   10a0 <printw@plt>
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
call   10f0 <scanw@plt>
mov    0xc(%rsp),%edi
mov    %r12d,%esi
call   1050 <bajio@plt>
jmp    1270 <main+0x90>
lea    0xdc2(%rip),%rdi
call   10a0 <printw@plt>
mov    %rbp,%rdi
call   1090 <getstr@plt>
lea    0xdd3(%rip),%rdi
call   10a0 <printw@plt>
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
call   10f0 <scanw@plt>
lea    0xdeb(%rip),%rdi
call   10a0 <printw@plt>
mov    %rbx,%rdi
lea    0x1c(%rsp),%rsi
call   10f0 <scanw@plt>
mov    0xc(%rsp),%edi
mov    0x1c(%rsp),%esi
mov    %rbp,%rdx
lea    0x14(%rsp),%rcx
mov    %r12d,%r8d
call   10b0 <ventas@plt>
movss  0x10(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
jmp    1270 <main+0x90>
mov    0x14(%rsp),%edi
movss  0x10(%rsp),%xmm0
call   1080 <consultaf@plt>
jmp    1270 <main+0x90>
lea    0xdb7(%rip),%rdi
call   10a0 <printw@plt>
mov    %rbp,%rdi
call   1090 <getstr@plt>
mov    0x14(%rsp),%esi
mov    %rbp,%rdi
call   1070 <consultan@plt>
jmp    1270 <main+0x90>
xor    %eax,%eax
call   10d0 <endwin@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [186 x i8] c"MENU\0A\0A\091) Registro De Articulos\0A\092) Consulta General\0A\093) Consulta Por Articulo\0A\094) Bajas\0A\095) Ventas\0A\096) Consulta de Facturas\0A\097) Consulta Por Nombre\0A\098) Salir\0A\0AIntroduce tu Eleccion:\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [48 x i8] c"Introdusca el Codigo de Barras del articulo:\0A>>\00"
@.str.3 = [37 x i8] c"Introdusca el Nombre del cliente:\0A>>\00"
@.str.4 = [49 x i8] c"\0AIntrodusca el Codigo de Barras del articulo:\0A>>\00"
@.str.5 = [38 x i8] c"\0AIntrodusca la cantidad a comprar:\0A>>\00"
@.str.6 = [46 x i8] c"Introdusca el Nombre del cliente a buscar:\0A>>\00"
@.str.7 = [47 x i8] c"Gracias por usar el programa, Vuelva pronto.\0A\0A\00"
@.str.8 = [21 x i8] c"[PRESIONE UNA TECLA]\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [50 x i8]
%8 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store float 0.000000e+00, float* %8
%9 = call i32 (...) @initscr()
br label %10
10: ; preds = %64, %0
%11 = call i32 (...) @clear()
%12 = call i32 @printw(i8* getelementptr inbounds ([186 x i8], [186 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
switch i32 %14, label %63 [
i32 1, label %15
i32 2, label %17
i32 3, label %20
i32 4, label %26
i32 5, label %32
i32 6, label %47
i32 7, label %51
i32 8, label %58
]
15: ; preds = %10
%16 = call i32 (...) @registro()
store i32 %16, i32* %3
br label %63
17: ; preds = %10
%18 = load i32, i32* %3
%19 = call i32 @consultag(i32 %18)
br label %63
20: ; preds = %10
%21 = call i32 @printw(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = call i32 @consultab(i32 %23, i32 %24)
br label %63
26: ; preds = %10
%27 = call i32 @printw(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%29 = load i32, i32* %4
%30 = load i32, i32* %3
%31 = call i32 @bajio(i32 %29, i32 %30)
br label %63
32: ; preds = %10
%33 = call i32 @printw(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%34 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%35 = call i32 @getstr(i8* %34)
%36 = call i32 @printw(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%37 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%38 = call i32 @printw(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%40 = load i32, i32* %4
%41 = load i32, i32* %5
%42 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%43 = load i32, i32* %3
%44 = call float @ventas(i32 %40, i32 %41, i8* %42, i32* %6, i32 %43)
%45 = load float, float* %8
%46 = fadd float %45, %44
store float %46, float* %8
br label %63
47: ; preds = %10
%48 = load float, float* %8
%49 = load i32, i32* %6
%50 = call i32 @consultaf(float %48, i32 %49)
br label %63
51: ; preds = %10
%52 = call i32 @printw(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%53 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%54 = call i32 @getstr(i8* %53)
%55 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%56 = load i32, i32* %6
%57 = call i32 @consultan(i8* %55, i32 %56)
br label %63
58: ; preds = %10
%59 = call i32 (...) @clear()
%60 = call i32 @printw(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%61 = call i32 @printw(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%62 = call i32 (...) @getch()
br label %63
63: ; preds = %10, %58, %51, %47, %32, %26, %20, %17, %15
br label %64
64: ; preds = %63
%65 = load i32, i32* %2
%66 = icmp ne i32 %65, 8
br i1 %66, label %10, label %67
67: ; preds = %64
%68 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@.str = [186 x i8] c"MENU\0A\0A\091) Registro De Articulos\0A\092) Consulta General\0A\093) Consulta Por Articulo\0A\094) Bajas\0A\095) Ventas\0A\096) Consulta de Facturas\0A\097) Consulta Por Nombre\0A\098) Salir\0A\0AIntroduce tu Eleccion:\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [48 x i8] c"Introdusca el Codigo de Barras del articulo:\0A>>\00"
@.str.3 = [37 x i8] c"Introdusca el Nombre del cliente:\0A>>\00"
@.str.4 = [49 x i8] c"\0AIntrodusca el Codigo de Barras del articulo:\0A>>\00"
@.str.5 = [38 x i8] c"\0AIntrodusca la cantidad a comprar:\0A>>\00"
@.str.6 = [46 x i8] c"Introdusca el Nombre del cliente a buscar:\0A>>\00"
@.str.7 = [47 x i8] c"Gracias por usar el programa, Vuelva pronto.\0A\0A\00"
@.str.8 = [21 x i8] c"[PRESIONE UNA TECLA]\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [50 x i8]
%6 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%7 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%8 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%9 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%11 = tail call i32 (...) @initscr()
br label %12
12: ; preds = %61, %0
%13 = phi i32 [ 0, %0 ], [ %63, %61 ]
%14 = phi float [ 0.000000e+00, %0 ], [ %64, %61 ]
%15 = call i32 (...) @clear()
%16 = call i32 @printw(i8* getelementptr inbounds ([186 x i8], [186 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
switch i32 %18, label %61 [
i32 1, label %19
i32 2, label %21
i32 3, label %23
i32 4, label %28
i32 5, label %33
i32 6, label %44
i32 7, label %47
i32 8, label %52
]
19: ; preds = %12
%20 = call i32 (...) @registro()
br label %57
21: ; preds = %12
%22 = call i32 @consultag(i32 %13)
br label %57
23: ; preds = %12
%24 = call i32 @printw(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%26 = load i32, i32* %2
%27 = call i32 @consultab(i32 %26, i32 %13)
br label %57
28: ; preds = %12
%29 = call i32 @printw(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%31 = load i32, i32* %2
%32 = call i32 @bajio(i32 %31, i32 %13)
br label %57
33: ; preds = %12
%34 = call i32 @printw(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @getstr(i8* %10)
%36 = call i32 @printw(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%37 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%38 = call i32 @printw(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = call float @ventas(i32 %40, i32 %41, i8* %10, i32* %4, i32 %13)
%43 = fadd float %14, %42
br label %57
44: ; preds = %12
%45 = load i32, i32* %4
%46 = call i32 @consultaf(float %14, i32 %45)
br label %57
47: ; preds = %12
%48 = call i32 @printw(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%49 = call i32 @getstr(i8* %10)
%50 = load i32, i32* %4
%51 = call i32 @consultan(i8* %10, i32 %50)
br label %57
52: ; preds = %12
%53 = call i32 (...) @clear()
%54 = call i32 @printw(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%55 = call i32 @printw(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%56 = call i32 (...) @getch()
br label %57
57: ; preds = %52, %47, %44, %33, %28, %23, %21, %19
%58 = phi i32 [ %20, %19 ], [ %13, %21 ], [ %13, %23 ], [ %13, %28 ], [ %13, %33 ], [ %13, %44 ], [ %13, %47 ], [ %13, %52 ]
%59 = phi float [ %14, %19 ], [ %14, %21 ], [ %14, %23 ], [ %14, %28 ], [ %43, %33 ], [ %14, %44 ], [ %14, %47 ], [ %14, %52 ]
%60 = load i32, i32* %1
br label %61
61: ; preds = %57, %12
%62 = phi i32 [ %60, %57 ], [ %18, %12 ]
%63 = phi i32 [ %58, %57 ], [ %13, %12 ]
%64 = phi float [ %59, %57 ], [ %14, %12 ]
%65 = icmp eq i32 %62, 8
br i1 %65, label %66, label %12
66: ; preds = %61
%67 = call i32 (...) @endwin()
ret i32 0
}