#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*/ change_pos(int *, int *);
int /*<<< orphan*/ print_tablero(int *, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  srand(time(0));
  int tx = 0, lx = 0, i = 1, countdown = 3;
  while (tx < 70 && lx < 70) {
    system("clear");
    if (countdown == 0) {
      print_tablero(&tx, &lx, i);
      if (i == 1) {
        i = 0;
      }
      change_pos(&tx, &lx);
    } else {
      printf("%d\n", countdown);
      for (int i = 0; i < 70; i++)
        printf("-");
      printf("\n");
      countdown--;
    }
    sleep(1);
  }
  if (tx >= lx)
    printf("\n\nLa tortuga ha ganado!\n");
  else
    printf("\n\nLa liebre ha ganado!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x46,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jge    11c2 <main+0x52>
cmpl   $0x46,-0xc(%rbp)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11d2 <main+0x62>
jmp    127f <main+0x10f>
lea    0xe27(%rip),%rdi
call   1050 <system@plt>
cmpl   $0x0,-0x14(%rbp)
jne    121b <main+0xab>
mov    -0x10(%rbp),%edx
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <print_tablero@plt>
cmpl   $0x1,-0x10(%rbp)
jne    1209 <main+0x99>
movl   $0x0,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <change_pos@plt>
jmp    1270 <main+0x100>
mov    -0x14(%rbp),%esi
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x46,-0x18(%rbp)
jge    1259 <main+0xe9>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1233 <main+0xc3>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%edi
call   1090 <sleep@plt>
jmp    11a9 <main+0x39>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     129e <main+0x12e>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12ac <main+0x13c>
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
mov    $0x1,%ebx
mov    $0x3,%ebp
lea    0xe37(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1070 <system@plt>
test   %ebp,%ebp
je     1230 <main+0xa0>
lea    0xe13(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x46,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2d,%edi
call   1040 <putchar@plt>
add    $0xffffffff,%r13d
jne    1210 <main+0x80>
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0xffffffff,%ebp
jmp    1250 <main+0xc0>
nop
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1030 <print_tablero@plt>
xor    %ebp,%ebp
cmp    $0x1,%ebx
cmove  %ebp,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <change_pos@plt>
mov    $0x1,%edi
call   10b0 <sleep@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
cmp    $0x45,%eax
jg     126f <main+0xdf>
cmp    $0x46,%ecx
jl     11e0 <main+0x50>
cmp    %ecx,%eax
lea    0xd92(%rip),%rax
lea    0xda2(%rip),%rdi
cmovl  %rax,%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [25 x i8] c"\0A\0ALa tortuga ha ganado!\0A\00"
@.str.5 = [24 x i8] c"\0A\0ALa liebre ha ganado!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @time(i32 0)
%8 = call i32 @srand(i32 %7)
store i32 0, i32* %2
store i32 0, i32* %3
store i32 1, i32* %4
store i32 3, i32* %5
br label %9
9: ; preds = %44, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 70
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 70
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ false, %9 ], [ %14, %12 ]
br i1 %16, label %17, label %46
17: ; preds = %15
%18 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = load i32, i32* %4
%23 = call i32 @print_tablero(i32* %2, i32* %3, i32 %22)
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 0, i32* %4
br label %27
27: ; preds = %26, %21
%28 = call i32 @change_pos(i32* %2, i32* %3)
br label %44
29: ; preds = %17
%30 = load i32, i32* %5
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
store i32 0, i32* %6
br label %32
32: ; preds = %37, %29
%33 = load i32, i32* %6
%34 = icmp slt i32 %33, 70
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %32
40: ; preds = %32
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32, i32* %5
%43 = add nsw i32 %42, -1
store i32 %43, i32* %5
br label %44
44: ; preds = %40, %27
%45 = call i32 @sleep(i32 1)
br label %9
46: ; preds = %15
%47 = load i32, i32* %2
%48 = load i32, i32* %3
%49 = icmp sge i32 %47, %48
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
br label %54
52: ; preds = %46
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [23 x i8] c"\0A\0ALa liebre ha ganado!\00"
@str.6 = [24 x i8] c"\0A\0ALa tortuga ha ganado!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32 @time(i32 0)
%4 = tail call i32 @srand(i32 %3)
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
br label %7
7: ; preds = %0, %27
%8 = phi i32 [ %29, %27 ], [ 3, %0 ]
%9 = phi i32 [ %28, %27 ], [ 1, %0 ]
%10 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %8, 0
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = call i32 @print_tablero(i32* %1, i32* %2, i32 %9)
%14 = icmp eq i32 %9, 1
%15 = select i1 %14, i32 0, i32 %9
%16 = call i32 @change_pos(i32* %1, i32* %2)
br label %27
17: ; preds = %7
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %22
19: ; preds = %22
%20 = call i32 @putchar(i32 10)
%21 = add nsw i32 %8, -1
br label %27
22: ; preds = %17, %22
%23 = phi i32 [ 0, %17 ], [ %25, %22 ]
%24 = call i32 @putchar(i32 45)
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, 70
br i1 %26, label %19, label %22
27: ; preds = %19, %12
%28 = phi i32 [ %15, %12 ], [ %9, %19 ]
%29 = phi i32 [ 0, %12 ], [ %21, %19 ]
%30 = call i32 @sleep(i32 1)
%31 = load i32, i32* %1
%32 = icmp slt i32 %31, 70
%33 = load i32, i32* %2
%34 = icmp slt i32 %33, 70
%35 = select i1 %32, i1 %34, i1 false
br i1 %35, label %7, label %36
36: ; preds = %27
%37 = icmp slt i32 %31, %33
%38 = select i1 %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.6, i64 0, i64 0)
%39 = call i32 @puts(i8* dereferenceable(1) %38)
ret i32 0
}