#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*/ init_lineal();
int /*<<< orphan*/ init_polinomial();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
void minimos() {
  int op;
  printf("MINIMOS CUADRADOS\n");
  printf("1.- Regresion Lineal\n");
  printf("2.- Regresion Polinomial\n");
  printf("Elige una opcion: ");
  scanf("%d", &op);
  switch (op) {
  case 1:
    system("cls");
    init_lineal();
    break;
  case 2:
    system("cls");
    init_polinomial();
    break;
  default:
    printf("Opcion Incorrecta\n");
    system("pause");
    system("cls");
    break;
  }
}


x86 assembly (clang, -O0):
<minimos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1050 <printf@plt>
lea    0xea8(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1050 <printf@plt>
lea    0xec0(%rip),%rdi
call   1050 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     11bd <minimos+0x6d>
jmp    11ac <minimos+0x5c>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11d5 <minimos+0x85>
jmp    11ed <minimos+0x9d>
lea    0xe95(%rip),%rdi
call   1040 <system@plt>
mov    $0x0,%al
call   1060 <init_lineal@plt>
jmp    1211 <minimos+0xc1>
lea    0xe7d(%rip),%rdi
call   1040 <system@plt>
mov    $0x0,%al
call   1030 <init_polinomial@plt>
jmp    1211 <minimos+0xc1>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
lea    0xe70(%rip),%rdi
call   1040 <system@plt>
lea    0xe4d(%rip),%rdi
call   1040 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minimos>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe74(%rip),%rdi
call   1060 <printf@plt>
lea    0xe7b(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     11c5 <minimos+0x65>
cmp    $0x1,%eax
jne    11da <minimos+0x7a>
lea    0xe5f(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
call   1070 <init_lineal@plt>
pop    %rax
ret
lea    0xe4a(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
call   1040 <init_polinomial@plt>
pop    %rax
ret
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2d(%rip),%rdi
call   1050 <system@plt>
lea    0xe1d(%rip),%rdi
call   1050 <system@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"MINIMOS CUADRADOS\0A\00"
@.str.1 = [22 x i8] c"1.- Regresion Lineal\0A\00"
@.str.2 = [26 x i8] c"2.- Regresion Polinomial\0A\00"
@.str.3 = [19 x i8] c"Elige una opcion: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [4 x i8] c"cls\00"
@.str.6 = [19 x i8] c"Opcion Incorrecta\0A\00"
@.str.7 = [6 x i8] c"pause\00"
define void @minimos() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %14 [
i32 1, label %8
i32 2, label %11
]
8: ; preds = %0
%9 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (...) @init_lineal()
br label %18
11: ; preds = %0
%12 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (...) @init_polinomial()
br label %18
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %18
18: ; preds = %14, %11, %8
ret void
}

LLVM IR (-O2):
@.str.3 = [19 x i8] c"Elige una opcion: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [4 x i8] c"cls\00"
@.str.7 = [6 x i8] c"pause\00"
@str = [18 x i8] c"MINIMOS CUADRADOS\00"
@str.8 = [21 x i8] c"1.- Regresion Lineal\00"
@str.9 = [25 x i8] c"2.- Regresion Polinomial\00"
@str.10 = [18 x i8] c"Opcion Incorrecta\00"
define void @minimos() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
switch i32 %8, label %15 [
i32 1, label %9
i32 2, label %12
]
9: ; preds = %0
%10 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 (...) @init_lineal()
br label %19
12: ; preds = %0
%13 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (...) @init_polinomial()
br label %19
15: ; preds = %0
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.10, i64 0, i64 0))
%17 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %15, %12, %9
ret void
}