#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 MAX(int, int);
int MIN(int, int);
int getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf_s(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int x, num1 = 1, num2;
  printf("Dame el primer numero: ");
  scanf_s("%i", &num1);
  printf("Dame el segundo numero: ");
  scanf_s("%i", &num2);
  printf("Maximo (1) o Minimo (2)?\n");
  switch (getch()) {
  case '1':
    x = MAX(num1, num2);
    printf("El %i es el mayor\n", x);
    break;
  case '2':
    x = MIN(num1, num2);
    printf("El %i es el menor\n", x);
    break;
  default:
    main();
    break;
  }
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xe73(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x15(%rbp)
call   1060 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    %rdi,-0x20(%rbp)
lea    -0xc(%rbp),%rsi
call   1090 <scanf_s@plt>
mov    -0x15(%rbp),%al
lea    0xe66(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1090 <scanf_s@plt>
mov    -0x15(%rbp),%al
lea    0xe63(%rip),%rdi
call   1060 <printf@plt>
mov    -0x15(%rbp),%al
call   1080 <getch@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x31,%eax
je     1202 <main+0x92>
jmp    11f1 <main+0x81>
mov    -0x14(%rbp),%eax
sub    $0x32,%eax
je     1226 <main+0xb6>
jmp    124a <main+0xda>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <MAX@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    124f <main+0xdf>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <MIN@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    124f <main+0xdf>
call   1070 <main@plt>
lea    0xe1e(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0x8(%rsp)
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe76(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf_s@plt>
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf_s@plt>
lea    0xe8f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1090 <getch@plt>
cmp    $0x32,%eax
je     11fd <main+0x7d>
cmp    $0x31,%eax
jne    121c <main+0x9c>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <MAX@plt>
lea    0xe39(%rip),%rdi
jmp    1211 <main+0x91>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
call   1030 <MIN@plt>
lea    0xe36(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1221 <main+0xa1>
call   1080 <main@plt>
lea    0xe32(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Dame el primer numero: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [25 x i8] c"Dame el segundo numero: \00"
@.str.3 = [26 x i8] c"Maximo (1) o Minimo (2)?\0A\00"
@.str.4 = [19 x i8] c"El %i es el mayor\0A\00"
@.str.5 = [19 x i8] c"El %i es el menor\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (...) @getch()
switch i32 %10, label %23 [
i32 49, label %11
i32 50, label %17
]
11: ; preds = %0
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @MAX(i32 %12, i32 %13)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %15)
br label %25
17: ; preds = %0
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 @MIN(i32 %18, i32 %19)
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %21)
br label %25
23: ; preds = %0
%24 = call i32 @main()
br label %25
25: ; preds = %23, %17, %11
%26 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Dame el primer numero: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [25 x i8] c"Dame el segundo numero: \00"
@.str.4 = [19 x i8] c"El %i es el mayor\0A\00"
@.str.5 = [19 x i8] c"El %i es el menor\0A\00"
@.str.6 = [6 x i8] c"pause\00"
@str = [25 x i8] c"Maximo (1) o Minimo (2)?\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%10 = call i32 (...) @getch()
switch i32 %10, label %21 [
i32 49, label %11
i32 50, label %16
]
11: ; preds = %0
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call i32 @MAX(i32 %12, i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %14)
br label %23
16: ; preds = %0
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @MIN(i32 %17, i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %19)
br label %23
21: ; preds = %0
%22 = call i32 @main()
br label %23
23: ; preds = %21, %16, %11
%24 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}