#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 getint(char *);
int mayor3(int, int, int);
int /*<<< orphan*/ printf(char *, double);
double promedio3(int, int, int);
int main(void) {
  int x, y, z;
  x = getint("Ingrese un numero: ");
  y = getint("\nIngrese otro numero: ");
  z = getint("\nIngrese ultimo numero: ");
  printf("\nEl mayor es %d\n", mayor3(x, y, z));
  printf("El promedio es %.2g\n", promedio3(x, y, z));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <getint@plt>
mov    %eax,-0x8(%rbp)
lea    0xeaf(%rip),%rdi
call   1040 <getint@plt>
mov    %eax,-0xc(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <getint@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1060 <mayor3@plt>
cvtsi2sd %eax,%xmm0
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <promedio3@plt>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xeb5(%rip),%rdi
call   1040 <getint@plt>
mov    %eax,%r14d
lea    0xeba(%rip),%rdi
call   1040 <getint@plt>
mov    %eax,%ebp
lea    0xec3(%rip),%rdi
call   1040 <getint@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1060 <mayor3@plt>
cvtsi2sd %eax,%xmm0
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1050 <promedio3@plt>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Ingrese un numero: \00"
@.str.1 = [23 x i8] c"\0AIngrese otro numero: \00"
@.str.2 = [25 x i8] c"\0AIngrese ultimo numero: \00"
@.str.3 = [17 x i8] c"\0AEl mayor es %d\0A\00"
@.str.4 = [21 x i8] c"El promedio es %.2g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @getint(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %2
%6 = call i32 @getint(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 %6, i32* %3
%7 = call i32 @getint(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @mayor3(i32 %8, i32 %9, i32 %10)
%12 = sitofp i32 %11 to double
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %12)
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call double @promedio3(i32 %14, i32 %15, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Ingrese un numero: \00"
@.str.1 = [23 x i8] c"\0AIngrese otro numero: \00"
@.str.2 = [25 x i8] c"\0AIngrese ultimo numero: \00"
@.str.3 = [17 x i8] c"\0AEl mayor es %d\0A\00"
@.str.4 = [21 x i8] c"El promedio es %.2g\0A\00"
define i32 @main() {
%1 = tail call i32 @getint(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @getint(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @getint(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @mayor3(i32 %1, i32 %2, i32 %3)
%5 = sitofp i32 %4 to double
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %5)
%7 = tail call double @promedio3(i32 %1, i32 %2, i32 %3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %7)
ret i32 0
}