#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*/ delay_ms(int);
int /*<<< orphan*/ mostraNumero(int, int);
void rodaContador() {
  int contador_4 = 0;
  int contador_3 = 0;
  int contador_2 = 0;
  int contador_1 = 0;
  delay_ms(100);
  while (1) {
    mostraNumero(contador_1, 4);
    mostraNumero(contador_2, 3);
    mostraNumero(contador_3, 2);
    mostraNumero(contador_4, 1);
    delay_ms(10);
    contador_1++;
    if (contador_1 > 9) {
      contador_1 = 0;
      contador_2++;
    }
    if (contador_2 > 9) {
      contador_2 = 0;
      contador_3++;
    }
    if (contador_3 > 9) {
      contador_3 = 0;
      contador_4++;
    }
    if (contador_4 > 9) {
      contador_1 = 0;
      contador_2 = 0;
      contador_3 = 0;
      contador_4 = 0;
    }
  }
}


x86 assembly (clang, -O0):
<rodaContador>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x64,%edi
call   1040 <delay_ms@plt>
mov    -0x10(%rbp),%edi
mov    $0x4,%esi
call   1030 <mostraNumero@plt>
mov    -0xc(%rbp),%edi
mov    $0x3,%esi
call   1030 <mostraNumero@plt>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1030 <mostraNumero@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <mostraNumero@plt>
mov    $0xa,%edi
call   1040 <delay_ms@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jle    11af <rodaContador+0x8f>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jle    11c9 <rodaContador+0xa9>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jle    11e3 <rodaContador+0xc3>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    1209 <rodaContador+0xe9>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    114e <rodaContador+0x2e>

x86 assembly (clang, -O2):
<rodaContador>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x64,%edi
call   1040 <delay_ms@plt>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
xor    %r15d,%r15d
xor    %r14d,%r14d
xor    %ebp,%ebp
xor    %ebx,%ebx
mov    %ebx,%edi
mov    $0x4,%esi
call   1030 <mostraNumero@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1030 <mostraNumero@plt>
mov    %r14d,%edi
mov    $0x2,%esi
call   1030 <mostraNumero@plt>
mov    %r15d,%edi
mov    $0x1,%esi
call   1030 <mostraNumero@plt>
mov    $0xa,%edi
call   1040 <delay_ms@plt>
xor    %eax,%eax
cmp    $0x9,%ebx
lea    0x1(%rbx),%ecx
setge  %al
cmovge %r12d,%ecx
add    %ebp,%eax
xor    %edx,%edx
cmp    $0xa,%eax
setge  %dl
cmovge %r12d,%eax
add    %r14d,%edx
xor    %esi,%esi
cmp    $0xa,%edx
setge  %sil
cmovge %r12d,%edx
add    %esi,%r15d
mov    %edx,%r14d
mov    %eax,%ebp
mov    %ecx,%ebx
cmp    $0xa,%r15d
jl     114a <rodaContador+0x2a>
jmp    1140 <rodaContador+0x20>

LLVM IR (-O0):
define void @rodaContador() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 @delay_ms(i32 100)
br label %6
6: ; preds = %0, %39
%7 = load i32, i32* %4
%8 = call i32 @mostraNumero(i32 %7, i32 4)
%9 = load i32, i32* %3
%10 = call i32 @mostraNumero(i32 %9, i32 3)
%11 = load i32, i32* %2
%12 = call i32 @mostraNumero(i32 %11, i32 2)
%13 = load i32, i32* %1
%14 = call i32 @mostraNumero(i32 %13, i32 1)
%15 = call i32 @delay_ms(i32 10)
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 9
br i1 %19, label %20, label %23
20: ; preds = %6
store i32 0, i32* %4
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %23
23: ; preds = %20, %6
%24 = load i32, i32* %3
%25 = icmp sgt i32 %24, 9
br i1 %25, label %26, label %29
26: ; preds = %23
store i32 0, i32* %3
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %29
29: ; preds = %26, %23
%30 = load i32, i32* %2
%31 = icmp sgt i32 %30, 9
br i1 %31, label %32, label %35
32: ; preds = %29
store i32 0, i32* %2
%33 = load i32, i32* %1
%34 = add nsw i32 %33, 1
store i32 %34, i32* %1
br label %35
35: ; preds = %32, %29
%36 = load i32, i32* %1
%37 = icmp sgt i32 %36, 9
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
store i32 0, i32* %1
br label %39
39: ; preds = %38, %35
br label %6
}

LLVM IR (-O2):
define void @rodaContador() {
%1 = tail call i32 @delay_ms(i32 100)
br label %2
2: ; preds = %27, %0
%3 = phi i32 [ 0, %0 ], [ %28, %27 ]
%4 = phi i32 [ 0, %0 ], [ %29, %27 ]
%5 = phi i32 [ 0, %0 ], [ %30, %27 ]
%6 = phi i32 [ 0, %0 ], [ %31, %27 ]
%7 = tail call i32 @mostraNumero(i32 %6, i32 4)
%8 = tail call i32 @mostraNumero(i32 %5, i32 3)
%9 = tail call i32 @mostraNumero(i32 %4, i32 2)
%10 = tail call i32 @mostraNumero(i32 %3, i32 1)
%11 = tail call i32 @delay_ms(i32 10)
%12 = add nsw i32 %6, 1
%13 = icmp sgt i32 %6, 8
%14 = zext i1 %13 to i32
%15 = add nsw i32 %5, %14
%16 = select i1 %13, i32 0, i32 %12
%17 = icmp sgt i32 %15, 9
%18 = zext i1 %17 to i32
%19 = add nsw i32 %4, %18
%20 = select i1 %17, i32 0, i32 %15
%21 = icmp sgt i32 %19, 9
%22 = zext i1 %21 to i32
%23 = add nsw i32 %3, %22
%24 = select i1 %21, i32 0, i32 %19
%25 = icmp sgt i32 %23, 9
br i1 %25, label %26, label %27
26: ; preds = %2
br label %27
27: ; preds = %26, %2
%28 = phi i32 [ 0, %26 ], [ %23, %2 ]
%29 = phi i32 [ 0, %26 ], [ %24, %2 ]
%30 = phi i32 [ 0, %26 ], [ %20, %2 ]
%31 = phi i32 [ 0, %26 ], [ %16, %2 ]
br label %2
}