#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*/ almacena_numero(int, int *);
scalar_t__ comprueba_numero_repetido(int, int *);
int genera_numero();
int /*<<< orphan*/ printf(char *);
int main(void) {
  int primitiva[49] = {0};
  int apuesta;
  int num;
  int i;
  printf("Este programa hace una apuesta aleatoria de primitiva \n");
  for (i = 0; i < 6; i++) {
    num = genera_numero();
    if (comprueba_numero_repetido(num, primitiva) == 0) {
      almacena_numero(num, primitiva);
    } else {
      i--;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc4,%edx
call   1050 <memset@plt>
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xdc(%rbp)
cmpl   $0x6,-0xdc(%rbp)
jge    1200 <main+0xb0>
mov    $0x0,%al
call   1030 <genera_numero@plt>
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%edi
lea    -0xd0(%rbp),%rsi
call   1070 <comprueba_numero_repetido@plt>
cmp    $0x0,%rax
jne    11d8 <main+0x88>
mov    -0xd8(%rbp),%edi
lea    -0xd0(%rbp),%rsi
call   1060 <almacena_numero@plt>
jmp    11e7 <main+0x97>
mov    -0xdc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xdc(%rbp)
jmp    11ec <main+0x9c>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    118b <main+0x3b>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xd0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0xc0(%rsp)
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r14
xor    %ebx,%ebx
jmp    11cd <main+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%ebx
lea    0x1(%rbx),%eax
cmp    $0x5,%ebx
mov    %eax,%ebx
jge    11f1 <main+0xb1>
xor    %eax,%eax
call   1040 <genera_numero@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r14,%rsi
call   1060 <comprueba_numero_repetido@plt>
test   %rax,%rax
jne    11c0 <main+0x80>
mov    %ebp,%edi
mov    %r14,%rsi
call   1050 <almacena_numero@plt>
jmp    11c3 <main+0x83>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Este programa hace una apuesta aleatoria de primitiva \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [49 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [49 x i32]* %2 to i8*
%7 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %8
8: ; preds = %25, %0
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = call i32 (...) @genera_numero()
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 0
%15 = call i64 @comprueba_numero_repetido(i32 %13, i32* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i32, i32* %4
%19 = getelementptr inbounds [49 x i32], [49 x i32]* %2, i64 0, i64 0
%20 = call i32 @almacena_numero(i32 %18, i32* %19)
br label %24
21: ; preds = %11
%22 = load i32, i32* %5
%23 = add nsw i32 %22, -1
store i32 %23, i32* %5
br label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %8
28: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@str = [55 x i8] c"Este programa hace una apuesta aleatoria de primitiva \00"
define i32 @main() {
%1 = alloca [49 x i32]
%2 = bitcast [49 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [49 x i32], [49 x i32]* %1, i64 0, i64 0
br label %5
5: ; preds = %0, %14
%6 = phi i32 [ 0, %0 ], [ %16, %14 ]
%7 = call i32 (...) @genera_numero()
%8 = call i64 @comprueba_numero_repetido(i32 %7, i32* %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = call i32 @almacena_numero(i32 %7, i32* %4)
br label %14
12: ; preds = %5
%13 = add nsw i32 %6, -1
br label %14
14: ; preds = %10, %12
%15 = phi i32 [ %6, %10 ], [ %13, %12 ]
%16 = add nsw i32 %15, 1
%17 = icmp slt i32 %15, 5
br i1 %17, label %5, label %18
18: ; preds = %14
ret i32 0
}