#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*/ cbreak();
int /*<<< orphan*/ clear();
int /*<<< orphan*/ getc(int /*<<< orphan*/);
int /*<<< orphan*/ getstr(char *);
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ scanw(char *, ...);
int /*<<< orphan*/ stdin;
void registra(int *ids[], int *tipos[], int *cants[], float *costos[],
              char *sabors[]) {
  static int x = 0;
  int opo = 0;
  do {
    clear();
    printw("introduce el id del pastel:\n>>");
    scanw("%d", ids[x]);
    printw("Indique el tipo de pastel:\n\t1) Comun\n\t2) XVs\n\t3) Bodas\n\t4) "
           "Especial\n\n>>");
    scanw("%d", tipos[x]);
    printw("Introduce la cantidad en existencia:\n>>");
    scanw("%d", *cants[x]);
    printw("Introduce el costo del producto:\n>>");
    scanw("%f", *costos[x]);
    cbreak();
    getc(stdin);
    printw("Indica el sabor del pastel:\n>>");
    getstr(sabors[x]);
    printw("desea ingresar otro?:\n\n\t0) NO\n\t1) SI\n\n>>");
    scanw("%d", &opo);
    x++;
  } while (opo);
}


x86 assembly (clang, -O0):
<registra>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    $0x0,%al
call   1070 <clear@plt>
lea    0xe6f(%rip),%rdi
call   1050 <printw@plt>
mov    -0x8(%rbp),%rax
movslq 0x2eb3(%rip),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1060 <scanw@plt>
lea    0xe68(%rip),%rdi
call   1050 <printw@plt>
mov    -0x10(%rbp),%rax
movslq 0x2e8a(%rip),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1060 <scanw@plt>
lea    0xe87(%rip),%rdi
call   1050 <printw@plt>
mov    -0x18(%rbp),%rax
movslq 0x2e61(%rip),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1060 <scanw@plt>
lea    0xe84(%rip),%rdi
call   1050 <printw@plt>
mov    -0x20(%rbp),%rax
movslq 0x2e36(%rip),%rcx
mov    (%rax,%rcx,8),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe85(%rip),%rdi
mov    $0x1,%al
call   1060 <scanw@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   1080 <getc@plt>
lea    0xe65(%rip),%rdi
call   1050 <printw@plt>
mov    -0x28(%rbp),%rax
movslq 0x2df0(%rip),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <getstr@plt>
lea    0xe64(%rip),%rdi
call   1050 <printw@plt>
lea    0xd9f(%rip),%rdi
lea    -0x2c(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanw@plt>
mov    0x2dc3(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2dba(%rip)
cmpl   $0x0,-0x2c(%rbp)
jne    1183 <registra+0x23>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<registra>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
lea    0xe96(%rip),%rbp
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <clear@plt>
lea    0xe62(%rip),%rdi
call   1050 <printw@plt>
movslq 0x2eaa(%rip),%rax
mov    (%rbx,%rax,8),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <scanw@plt>
lea    0xe63(%rip),%rdi
call   1050 <printw@plt>
movslq 0x2e89(%rip),%rax
mov    0x0(%r13,%rax,8),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <scanw@plt>
lea    0xe89(%rip),%rdi
call   1050 <printw@plt>
movslq 0x2e67(%rip),%rax
mov    (%r12,%rax,8),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <scanw@plt>
lea    0xe8e(%rip),%rdi
call   1050 <printw@plt>
movslq 0x2e44(%rip),%rax
mov    (%r15,%rax,8),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe93(%rip),%rdi
mov    $0x1,%al
call   1060 <scanw@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
call   1080 <getc@plt>
lea    0xe73(%rip),%rdi
call   1050 <printw@plt>
movslq 0x2e02(%rip),%rax
mov    (%r14,%rax,8),%rdi
call   1040 <getstr@plt>
lea    0xe76(%rip),%rdi
call   1050 <printw@plt>
mov    %rbp,%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanw@plt>
addl   $0x1,0x2dd7(%rip)
cmpl   $0x0,0x4(%rsp)
jne    1190 <registra+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@registra.x = internal global i32 0
@.str = [31 x i8] c"introduce el id del pastel:\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [72 x i8] c"Indique el tipo de pastel:\0A\091) Comun\0A\092) XVs\0A\093) Bodas\0A\094) Especial\0A\0A>>\00"
@.str.3 = [40 x i8] c"Introduce la cantidad en existencia:\0A>>\00"
@.str.4 = [36 x i8] c"Introduce el costo del producto:\0A>>\00"
@.str.5 = [3 x i8] c"%f\00"
@stdin = global i32 0
@.str.6 = [31 x i8] c"Indica el sabor del pastel:\0A>>\00"
@.str.7 = [41 x i8] c"desea ingresar otro?:\0A\0A\090) NO\0A\091) SI\0A\0A>>\00"
define void @registra(i32** %0, i32** %1, i32** %2, float** %3, i8** %4) {
%6 = alloca i32**
%7 = alloca i32**
%8 = alloca i32**
%9 = alloca float**
%10 = alloca i8**
%11 = alloca i32
store i32** %0, i32*** %6
store i32** %1, i32*** %7
store i32** %2, i32*** %8
store float** %3, float*** %9
store i8** %4, i8*** %10
store i32 0, i32* %11
br label %12
12: ; preds = %59, %5
%13 = call i32 (...) @clear()
%14 = call i32 @printw(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%15 = load i32**, i32*** %6
%16 = load i32, i32* @registra.x
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32*, i32** %15, i64 %17
%19 = load i32*, i32** %18
%20 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = call i32 @printw(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32**, i32*** %7
%23 = load i32, i32* @registra.x
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32*, i32** %22, i64 %24
%26 = load i32*, i32** %25
%27 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %26)
%28 = call i32 @printw(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%29 = load i32**, i32*** %8
%30 = load i32, i32* @registra.x
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32*, i32** %29, i64 %31
%33 = load i32*, i32** %32
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = call i32 @printw(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%37 = load float**, float*** %9
%38 = load i32, i32* @registra.x
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float*, float** %37, i64 %39
%41 = load float*, float** %40
%42 = load float, float* %41
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), double %43)
%45 = call i32 (...) @cbreak()
%46 = load i32, i32* @stdin
%47 = call i32 @getc(i32 %46)
%48 = call i32 @printw(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%49 = load i8**, i8*** %10
%50 = load i32, i32* @registra.x
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 @getstr(i8* %53)
%55 = call i32 @printw(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%56 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%57 = load i32, i32* @registra.x
%58 = add nsw i32 %57, 1
store i32 %58, i32* @registra.x
br label %59
59: ; preds = %12
%60 = load i32, i32* %11
%61 = icmp ne i32 %60, 0
br i1 %61, label %12, label %62
62: ; preds = %59
ret void
}

LLVM IR (-O2):
@registra.x = internal unnamed_addr global i32 0
@.str = [31 x i8] c"introduce el id del pastel:\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [72 x i8] c"Indique el tipo de pastel:\0A\091) Comun\0A\092) XVs\0A\093) Bodas\0A\094) Especial\0A\0A>>\00"
@.str.3 = [40 x i8] c"Introduce la cantidad en existencia:\0A>>\00"
@.str.4 = [36 x i8] c"Introduce el costo del producto:\0A>>\00"
@.str.5 = [3 x i8] c"%f\00"
@stdin = global i32 0
@.str.6 = [31 x i8] c"Indica el sabor del pastel:\0A>>\00"
@.str.7 = [41 x i8] c"desea ingresar otro?:\0A\0A\090) NO\0A\091) SI\0A\0A>>\00"
define void @registra(i32** nocapture %0, i32** nocapture %1, i32** nocapture %2, float** nocapture %3, i8** nocapture %4) {
%6 = alloca i32
%7 = bitcast i32* %6 to i8*
store i32 0, i32* %6
br label %8
8: ; preds = %8, %5
%9 = call i32 (...) @clear()
%10 = call i32 @printw(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @registra.x
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32*, i32** %0, i64 %12
%14 = load i32*, i32** %13
%15 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = call i32 @printw(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @registra.x
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32*, i32** %1, i64 %18
%20 = load i32*, i32** %19
%21 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = call i32 @printw(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @registra.x
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32*, i32** %2, i64 %24
%26 = load i32*, i32** %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = call i32 @printw(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32, i32* @registra.x
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float*, float** %3, i64 %31
%33 = load float*, float** %32
%34 = load float, float* %33
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), double %35)
%37 = call i32 (...) @cbreak()
%38 = load i32, i32* @stdin
%39 = call i32 @getc(i32 %38)
%40 = call i32 @printw(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%41 = load i32, i32* @registra.x
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %4, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @getstr(i8* %44)
%46 = call i32 @printw(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%48 = load i32, i32* @registra.x
%49 = add nsw i32 %48, 1
store i32 %49, i32* @registra.x
%50 = load i32, i32* %6
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %8
52: ; preds = %8
ret void
}