#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*/ printf(char *, ...);
emp_anti_suel(int f_anios[3], int f_sueldos[3]) {
  int anio_men = f_anios[0];
  int suel_may = f_sueldos[0];
  int pos_anio, pos_suel = 0;
  int fam_i;
  for (fam_i = 0; fam_i < 3; fam_i++) {
    if (f_anios[fam_i] < anio_men) {
      anio_men = f_anios[fam_i];
      pos_anio = fam_i;
    }
  }
  for (fam_i = 0; fam_i < 3; fam_i++) {
    if (f_sueldos[fam_i] > suel_may) {
      suel_may = f_sueldos[fam_i];
      pos_suel = fam_i;
    }
  }
  if (pos_anio == pos_suel) {
    printf("\nEl empleado más antiguo es el que tiene el mayor sueldo.\n\n");
    return 1;
  } else {
    printf("\nEl empleado más antiguo NO tiene el mayor sueldo.");
    printf(
        "\n\nEl empleado que tiene el mayor sueldo es el n° %d, ganando %d.\n"
        "Ingreso en el año %d a la empresa\n\n",
        pos_suel + 1, suel_may, f_anios[pos_suel]);
    return 0;
  }
}


x86 assembly (clang, -O0):
<emp_anti_suel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1185 <emp_anti_suel+0x75>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x1c(%rbp),%eax
jge    1172 <emp_anti_suel+0x62>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1177 <emp_anti_suel+0x67>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1140 <emp_anti_suel+0x30>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    11d1 <emp_anti_suel+0xc1>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x20(%rbp),%eax
jle    11be <emp_anti_suel+0xae>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    11c3 <emp_anti_suel+0xb3>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    118c <emp_anti_suel+0x7c>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    11f7 <emp_anti_suel+0xe7>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    122e <emp_anti_suel+0x11e>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emp_anti_suel>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%ecx
mov    0x4(%rdi),%eax
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
cmovl  %eax,%ecx
mov    (%rsi),%ebp
mov    0x4(%rsi),%eax
xor    %ebx,%ebx
cmp    %ebp,%eax
cmovg  %eax,%ebp
setg   %bl
mov    0x8(%rsi),%eax
cmp    %ebp,%eax
mov    $0x2,%esi
cmovg  %esi,%ebx
cmp    %ecx,0x8(%rdi)
cmovl  %esi,%edx
cmp    %ebx,%edx
jne    1170 <emp_anti_suel+0x50>
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r15d
jmp    11a4 <emp_anti_suel+0x84>
mov    %rdi,%r14
cmp    %ebp,%eax
cmovg  %eax,%ebp
lea    0xe81(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x1,%ebx
mov    (%r14,%rax,4),%ecx
lea    0xe9b(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [61 x i8] c"\0AEl empleado m\C3\A1s antiguo es el que tiene el mayor sueldo.\0A\0A\00"
@.str.1 = [52 x i8] c"\0AEl empleado m\C3\A1s antiguo NO tiene el mayor sueldo.\00"
@.str.2 = [103 x i8] c"\0A\0AEl empleado que tiene el mayor sueldo es el n\C2\B0 %d, ganando %d.\0AIngreso en el a\C3\B1o %d a la empresa\0A\0A\00"
define i32 @emp_anti_suel(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = load i32, i32* %12
store i32 %13, i32* %6
%14 = load i32*, i32** %5
%15 = getelementptr inbounds i32, i32* %14, i64 0
%16 = load i32, i32* %15
store i32 %16, i32* %7
store i32 0, i32* %9
store i32 0, i32* %10
br label %17
17: ; preds = %36, %2
%18 = load i32, i32* %10
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %39
20: ; preds = %17
%21 = load i32*, i32** %4
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = load i32, i32* %6
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %35
28: ; preds = %20
%29 = load i32*, i32** %4
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
store i32 %33, i32* %6
%34 = load i32, i32* %10
store i32 %34, i32* %8
br label %35
35: ; preds = %28, %20
br label %36
36: ; preds = %35
%37 = load i32, i32* %10
%38 = add nsw i32 %37, 1
store i32 %38, i32* %10
br label %17
39: ; preds = %17
store i32 0, i32* %10
br label %40
40: ; preds = %59, %39
%41 = load i32, i32* %10
%42 = icmp slt i32 %41, 3
br i1 %42, label %43, label %62
43: ; preds = %40
%44 = load i32*, i32** %5
%45 = load i32, i32* %10
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
%49 = load i32, i32* %7
%50 = icmp sgt i32 %48, %49
br i1 %50, label %51, label %58
51: ; preds = %43
%52 = load i32*, i32** %5
%53 = load i32, i32* %10
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %52, i64 %54
%56 = load i32, i32* %55
store i32 %56, i32* %7
%57 = load i32, i32* %10
store i32 %57, i32* %9
br label %58
58: ; preds = %51, %43
br label %59
59: ; preds = %58
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %40
62: ; preds = %40
%63 = load i32, i32* %8
%64 = load i32, i32* %9
%65 = icmp eq i32 %63, %64
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %79
68: ; preds = %62
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%70 = load i32, i32* %9
%71 = add nsw i32 %70, 1
%72 = load i32, i32* %7
%73 = load i32*, i32** %4
%74 = load i32, i32* %9
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i32, i32* %73, i64 %75
%77 = load i32, i32* %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.2, i64 0, i64 0), i32 %71, i32 %72, i32 %77)
store i32 0, i32* %3
br label %79
79: ; preds = %68, %66
%80 = load i32, i32* %3
ret i32 %80
}

LLVM IR (-O2):
@.str.1 = [52 x i8] c"\0AEl empleado m\C3\A1s antiguo NO tiene el mayor sueldo.\00"
@.str.2 = [103 x i8] c"\0A\0AEl empleado que tiene el mayor sueldo es el n\C2\B0 %d, ganando %d.\0AIngreso en el a\C3\B1o %d a la empresa\0A\0A\00"
@str = [60 x i8] c"\0AEl empleado m\C3\A1s antiguo es el que tiene el mayor sueldo.\0A\00"
define i32 @emp_anti_suel(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = icmp slt i32 %6, %3
%8 = select i1 %7, i32 %6, i32 %3
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = icmp slt i32 %10, %8
%12 = getelementptr inbounds i32, i32* %1, i64 1
%13 = load i32, i32* %12
%14 = icmp sgt i32 %13, %4
%15 = select i1 %14, i32 %13, i32 %4
%16 = zext i1 %14 to i32
%17 = getelementptr inbounds i32, i32* %1, i64 2
%18 = load i32, i32* %17
%19 = icmp sgt i32 %18, %15
%20 = select i1 %19, i32 2, i32 %16
%21 = zext i1 %7 to i32
%22 = select i1 %11, i32 2, i32 %21
%23 = icmp eq i32 %22, %20
br i1 %23, label %24, label %26
24: ; preds = %2
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
br label %34
26: ; preds = %2
%27 = select i1 %19, i32 %18, i32 %15
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%29 = add nuw nsw i32 %20, 1
%30 = zext i32 %20 to i64
%31 = getelementptr inbounds i32, i32* %0, i64 %30
%32 = load i32, i32* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %27, i32 %32)
br label %34
34: ; preds = %26, %24
%35 = phi i32 [ 1, %24 ], [ 0, %26 ]
ret i32 %35
}