#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 comprobarDigitosNum(int, int);
int /*<<< orphan*/ comprobarNumeroMastermind(int *, char *, int, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ impresionPantalla(int);
int /*<<< orphan*/ imprimirCaracteres(char *, int);
int /*<<< orphan*/ llenarVectorNumAleatorios(int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int todosIguales(int *, char *, int);
int main() {
  int adivinar[4], numero, salida = 0, digitos;
  char resultadoComprobacion[4];
  llenarVectorNumAleatorios(adivinar, 4);
  impresionPantalla(1);
  getchar();
  do {
    impresionPantalla(2);
    scanf("%d", &numero);
    digitos = comprobarDigitosNum(numero, 4);
    if (digitos != 0)
      impresionPantalla(3);
    else {
      comprobarNumeroMastermind(adivinar, resultadoComprobacion, numero, 4);
      salida = todosIguales(adivinar, resultadoComprobacion, 4);
      impresionPantalla(4);
      imprimirCaracteres(resultadoComprobacion, 4);
    }
  } while (salida == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
call   1060 <llenarVectorNumAleatorios@plt>
mov    $0x1,%edi
call   1070 <impresionPantalla@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    $0x2,%edi
call   1070 <impresionPantalla@plt>
lea    0xe3a(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x24(%rbp),%edi
mov    $0x4,%esi
call   10a0 <comprobarDigitosNum@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     11f8 <main+0x78>
mov    $0x3,%edi
call   1070 <impresionPantalla@plt>
jmp    123a <main+0xba>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    $0x4,%ecx
call   1040 <comprobarNumeroMastermind@plt>
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1050 <todosIguales@plt>
mov    %eax,-0x28(%rbp)
mov    $0x4,%edi
call   1070 <impresionPantalla@plt>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
call   1030 <imprimirCaracteres@plt>
jmp    123f <main+0xbf>
cmpl   $0x0,-0x28(%rbp)
je     11b5 <main+0x35>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x4,%esi
call   1060 <llenarVectorNumAleatorios@plt>
mov    $0x1,%edi
call   1070 <impresionPantalla@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xe4a(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xc(%rsp),%rbx
jmp    1211 <main+0x91>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%ecx
call   1040 <comprobarNumeroMastermind@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1050 <todosIguales@plt>
mov    %eax,%ebp
mov    $0x4,%edi
call   1070 <impresionPantalla@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <imprimirCaracteres@plt>
test   %ebp,%ebp
jne    1248 <main+0xc8>
mov    $0x2,%edi
call   1070 <impresionPantalla@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1090 <scanf@plt>
mov    0x8(%rsp),%edi
mov    $0x4,%esi
call   10a0 <comprobarDigitosNum@plt>
test   %eax,%eax
je     11d0 <main+0x50>
mov    $0x3,%edi
call   1070 <impresionPantalla@plt>
xor    %ebp,%ebp
test   %ebp,%ebp
je     1211 <main+0x91>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [4 x i8]
store i32 0, i32* %1
store i32 0, i32* %4
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%8 = call i32 @llenarVectorNumAleatorios(i32* %7, i32 4)
%9 = call i32 @impresionPantalla(i32 1)
%10 = call i32 (...) @getchar()
br label %11
11: ; preds = %32, %0
%12 = call i32 @impresionPantalla(i32 2)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %3
%15 = call i32 @comprobarDigitosNum(i32 %14, i32 4)
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 @impresionPantalla(i32 3)
br label %31
20: ; preds = %11
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%23 = load i32, i32* %3
%24 = call i32 @comprobarNumeroMastermind(i32* %21, i8* %22, i32 %23, i32 4)
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%27 = call i32 @todosIguales(i32* %25, i8* %26, i32 4)
store i32 %27, i32* %4
%28 = call i32 @impresionPantalla(i32 4)
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%30 = call i32 @imprimirCaracteres(i8* %29, i32 4)
br label %31
31: ; preds = %20, %18
br label %32
32: ; preds = %31
%33 = load i32, i32* %4
%34 = icmp eq i32 %33, 0
br i1 %34, label %11, label %35
35: ; preds = %32
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = alloca [4 x i8]
%4 = bitcast [4 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%8 = call i32 @llenarVectorNumAleatorios(i32* %7, i32 4)
%9 = call i32 @impresionPantalla(i32 1)
%10 = call i32 (...) @getchar()
br label %11
11: ; preds = %25, %0
%12 = call i32 @impresionPantalla(i32 2)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = call i32 @comprobarDigitosNum(i32 %14, i32 4)
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %11
%18 = call i32 @impresionPantalla(i32 3)
br label %25
19: ; preds = %11
%20 = load i32, i32* %2
%21 = call i32 @comprobarNumeroMastermind(i32* %7, i8* %6, i32 %20, i32 4)
%22 = call i32 @todosIguales(i32* %7, i8* %6, i32 4)
%23 = call i32 @impresionPantalla(i32 4)
%24 = call i32 @imprimirCaracteres(i8* %6, i32 4)
br label %25
25: ; preds = %17, %19
%26 = phi i32 [ 0, %17 ], [ %22, %19 ]
%27 = icmp eq i32 %26, 0
br i1 %27, label %11, label %28
28: ; preds = %25
ret i32 0
}