#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*/ Consultar(int *, char **, float *, char *, int *);
int /*<<< orphan*/ addItem(int *, char **, float *);
int /*<<< orphan*/ facturar(char *, int *, int *, float *, char **);
int /*<<< orphan*/ getOption(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char option = 'x';
  int *codigo;
  char(*descripcion)[12];
  float *valor;
  int *posiciones;
  codigo = (int *)malloc(sizeof(int) * 100);
  descripcion = (char(*)[12])malloc(sizeof(char[12]) * 100);
  valor = (float *)malloc(sizeof(float) * 100);
  posiciones = (int *)malloc(sizeof(int) * 100);
  do {
    getOption(&option);
    printf("La opción escogida fue %c\n", option);
    switch (option) {
    case 'a':
      facturar(&option, codigo, posiciones, valor, descripcion);
      break;
    case 'b':
      Consultar(codigo, descripcion, valor, &option, posiciones);
      break;
    case 'c':
      addItem(codigo, descripcion, valor);
      break;
    case 'q':
      printf("\nSaliendo del programa..\n\n");
      break;
    default:
      printf("La opción %c escogida no es válida, seleccione de nuevo.\n",
             option);
    }
  } while (option != 'q');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x78,-0x5(%rbp)
mov    $0x190,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4b0,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x190,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x190,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
lea    -0x5(%rbp),%rdi
call   1040 <getOption@plt>
movsbl -0x5(%rbp),%esi
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x10,%eax
ja     1255 <main+0xf5>
mov    -0x30(%rbp),%rax
lea    0xe19(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    -0x5(%rbp),%rdi
call   1060 <facturar@plt>
jmp    1267 <main+0x107>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%r8
lea    -0x5(%rbp),%rcx
call   1030 <Consultar@plt>
jmp    1267 <main+0x107>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <addItem@plt>
jmp    1267 <main+0x107>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1267 <main+0x107>
movsbl -0x5(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    126c <main+0x10c>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
jne    11ab <main+0x4b>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movb   $0x78,0xf(%rsp)
mov    $0x190,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    $0x4b0,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    $0x190,%edi
call   1080 <malloc@plt>
mov    %rax,%r13
mov    $0x190,%edi
call   1080 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    0xf(%rsp),%rbx
lea    0xe7f(%rip),%rbp
lea    0xe34(%rip),%r12
jmp    11eb <main+0x7b>
xchg   %ax,%ax
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xchg   %ax,%ax
cmpb   $0x71,0xf(%rsp)
je     1271 <main+0x101>
mov    %rbx,%rdi
call   1050 <getOption@plt>
movsbl 0xf(%rsp),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xf(%rsp),%esi
lea    -0x61(%rsi),%eax
cmp    $0x10,%eax
ja     11d0 <main+0x60>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %rbx,%rdi
mov    %r14,%rsi
mov    0x10(%rsp),%rdx
mov    %r13,%rcx
mov    %r15,%r8
call   1070 <facturar@plt>
jmp    11e0 <main+0x70>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    0x10(%rsp),%r8
call   1040 <Consultar@plt>
jmp    11e0 <main+0x70>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1090 <addItem@plt>
jmp    11e0 <main+0x70>
lea    0xe35(%rip),%rdi
call   1030 <puts@plt>
jmp    11e0 <main+0x70>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"La opci\C3\B3n escogida fue %c\0A\00"
@.str.1 = [27 x i8] c"\0ASaliendo del programa..\0A\0A\00"
@.str.2 = [60 x i8] c"La opci\C3\B3n %c escogida no es v\C3\A1lida, seleccione de nuevo.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32*
%4 = alloca [12 x i8]*
%5 = alloca float*
%6 = alloca i32*
store i32 0, i32* %1
store i8 120, i8* %2
%7 = call i64 @malloc(i32 400)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %3
%9 = call i64 @malloc(i32 1200)
%10 = inttoptr i64 %9 to [12 x i8]*
store [12 x i8]* %10, [12 x i8]** %4
%11 = call i64 @malloc(i32 400)
%12 = inttoptr i64 %11 to float*
store float* %12, float** %5
%13 = call i64 @malloc(i32 400)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %6
br label %15
15: ; preds = %49, %0
%16 = call i32 @getOption(i8* %2)
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
switch i32 %21, label %44 [
i32 97, label %22
i32 98, label %29
i32 99, label %36
i32 113, label %42
]
22: ; preds = %15
%23 = load i32*, i32** %3
%24 = load i32*, i32** %6
%25 = load float*, float** %5
%26 = load [12 x i8]*, [12 x i8]** %4
%27 = bitcast [12 x i8]* %26 to i8**
%28 = call i32 @facturar(i8* %2, i32* %23, i32* %24, float* %25, i8** %27)
br label %48
29: ; preds = %15
%30 = load i32*, i32** %3
%31 = load [12 x i8]*, [12 x i8]** %4
%32 = bitcast [12 x i8]* %31 to i8**
%33 = load float*, float** %5
%34 = load i32*, i32** %6
%35 = call i32 @Consultar(i32* %30, i8** %32, float* %33, i8* %2, i32* %34)
br label %48
36: ; preds = %15
%37 = load i32*, i32** %3
%38 = load [12 x i8]*, [12 x i8]** %4
%39 = bitcast [12 x i8]* %38 to i8**
%40 = load float*, float** %5
%41 = call i32 @addItem(i32* %37, i8** %39, float* %40)
br label %48
42: ; preds = %15
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %48
44: ; preds = %15
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %44, %42, %36, %29, %22
br label %49
49: ; preds = %48
%50 = load i8, i8* %2
%51 = sext i8 %50 to i32
%52 = icmp ne i32 %51, 113
br i1 %52, label %15, label %53
53: ; preds = %49
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"La opci\C3\B3n escogida fue %c\0A\00"
@.str.2 = [60 x i8] c"La opci\C3\B3n %c escogida no es v\C3\A1lida, seleccione de nuevo.\0A\00"
@str = [26 x i8] c"\0ASaliendo del programa..\0A\00"
define i32 @main() {
%1 = alloca i8
store i8 120, i8* %1
%2 = tail call i64 @malloc(i32 400)
%3 = inttoptr i64 %2 to i32*
%4 = tail call i64 @malloc(i32 1200)
%5 = tail call i64 @malloc(i32 400)
%6 = inttoptr i64 %5 to float*
%7 = tail call i64 @malloc(i32 400)
%8 = inttoptr i64 %7 to i32*
%9 = inttoptr i64 %4 to i8**
br label %10
10: ; preds = %27, %0
%11 = call i32 @getOption(i8* %1)
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i8, i8* %1
%16 = sext i8 %15 to i32
switch i32 %16, label %25 [
i32 97, label %17
i32 98, label %19
i32 99, label %21
i32 113, label %23
]
17: ; preds = %10
%18 = call i32 @facturar(i8* %1, i32* %3, i32* %8, float* %6, i8** %9)
br label %27
19: ; preds = %10
%20 = call i32 @Consultar(i32* %3, i8** %9, float* %6, i8* %1, i32* %8)
br label %27
21: ; preds = %10
%22 = call i32 @addItem(i32* %3, i8** %9, float* %6)
br label %27
23: ; preds = %10
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %27
25: ; preds = %10
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %27
27: ; preds = %17, %19, %21, %23, %25
%28 = load i8, i8* %1
%29 = icmp eq i8 %28, 113
br i1 %29, label %30, label %10
30: ; preds = %27
ret i32 0
}