#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*/ gpio_set(int, int);
int /*<<< orphan*/ gpio_set_function(int, int);
int /*<<< orphan*/ sys_timer_wait(unsigned int);
void blinker_n(unsigned int t_on, unsigned int t_off,
               unsigned int num_repeats) {
  if (!num_repeats)
    return;
  gpio_set_function(16, 1);
  gpio_set(16, 0);
  sys_timer_wait(t_on);
  num_repeats--;
  while (num_repeats > 0) {
    gpio_set(16, 1);
    sys_timer_wait(t_off);
    gpio_set(16, 0);
    sys_timer_wait(t_on);
    num_repeats--;
  }
  gpio_set(16, 1);
}


x86 assembly (clang, -O0):
<blinker_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1150 <blinker_n+0x20>
jmp    11ce <blinker_n+0x9e>
mov    $0x10,%edi
mov    $0x1,%esi
call   1030 <gpio_set_function@plt>
mov    $0x10,%edi
xor    %esi,%esi
call   1040 <gpio_set@plt>
mov    -0x4(%rbp),%edi
call   1050 <sys_timer_wait@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jbe    11bf <blinker_n+0x8f>
mov    $0x10,%edi
mov    $0x1,%esi
call   1040 <gpio_set@plt>
mov    -0x8(%rbp),%edi
call   1050 <sys_timer_wait@plt>
mov    $0x10,%edi
xor    %esi,%esi
call   1040 <gpio_set@plt>
mov    -0x4(%rbp),%edi
call   1050 <sys_timer_wait@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    117c <blinker_n+0x4c>
mov    $0x10,%edi
mov    $0x1,%esi
call   1040 <gpio_set@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blinker_n>:
test   %edx,%edx
je     118a <blinker_n+0x5a>
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0x10,%edi
mov    $0x1,%esi
call   1030 <gpio_set_function@plt>
xchg   %ax,%ax
mov    $0x10,%edi
xor    %esi,%esi
call   1040 <gpio_set@plt>
mov    %ebp,%edi
call   1050 <sys_timer_wait@plt>
mov    $0x10,%edi
mov    $0x1,%esi
add    $0xffffffff,%ebx
je     1181 <blinker_n+0x51>
call   1040 <gpio_set@plt>
mov    %r14d,%edi
call   1050 <sys_timer_wait@plt>
jmp    1150 <blinker_n+0x20>
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <gpio_set@plt>
ret

LLVM IR (-O0):
define void @blinker_n(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %3
br label %31
10: ; preds = %3
%11 = call i32 @gpio_set_function(i32 16, i32 1)
%12 = call i32 @gpio_set(i32 16, i32 0)
%13 = load i32, i32* %4
%14 = call i32 @sys_timer_wait(i32 %13)
%15 = load i32, i32* %6
%16 = add i32 %15, -1
store i32 %16, i32* %6
br label %17
17: ; preds = %20, %10
%18 = load i32, i32* %6
%19 = icmp ugt i32 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = call i32 @gpio_set(i32 16, i32 1)
%22 = load i32, i32* %5
%23 = call i32 @sys_timer_wait(i32 %22)
%24 = call i32 @gpio_set(i32 16, i32 0)
%25 = load i32, i32* %4
%26 = call i32 @sys_timer_wait(i32 %25)
%27 = load i32, i32* %6
%28 = add i32 %27, -1
store i32 %28, i32* %6
br label %17
29: ; preds = %17
%30 = call i32 @gpio_set(i32 16, i32 1)
br label %31
31: ; preds = %29, %9
ret void
}

LLVM IR (-O2):
define void @blinker_n(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %21, label %5
5: ; preds = %3
%6 = tail call i32 @gpio_set_function(i32 16, i32 1)
%7 = tail call i32 @gpio_set(i32 16, i32 0)
%8 = tail call i32 @sys_timer_wait(i32 %0)
%9 = add i32 %2, -1
%10 = icmp eq i32 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %5, %11
%12 = phi i32 [ %17, %11 ], [ %9, %5 ]
%13 = tail call i32 @gpio_set(i32 16, i32 1)
%14 = tail call i32 @sys_timer_wait(i32 %1)
%15 = tail call i32 @gpio_set(i32 16, i32 0)
%16 = tail call i32 @sys_timer_wait(i32 %0)
%17 = add i32 %12, -1
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %5
%20 = tail call i32 @gpio_set(i32 16, i32 1)
br label %21
21: ; preds = %3, %19
ret void
}