#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*/ blinker_n(int, int, unsigned int);
int /*<<< orphan*/ sys_timer_wait(int);
void err_msg_blink(unsigned int code, unsigned int num_repeats) {
  if (!num_repeats)
    return;
  blinker_n(50000, 500000, code);
  num_repeats--;
  while (num_repeats > 0) {
    sys_timer_wait(2000000);
    blinker_n(50000, 500000, code);
    num_repeats--;
  }
}


x86 assembly (clang, -O0):
<err_msg_blink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113d <err_msg_blink+0x1d>
jmp    118c <err_msg_blink+0x6c>
mov    -0x4(%rbp),%edx
mov    $0xc350,%edi
mov    $0x7a120,%esi
call   1030 <blinker_n@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    118c <err_msg_blink+0x6c>
mov    $0x1e8480,%edi
call   1040 <sys_timer_wait@plt>
mov    -0x4(%rbp),%edx
mov    $0xc350,%edi
mov    $0x7a120,%esi
call   1030 <blinker_n@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <err_msg_blink+0x38>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_msg_blink>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
je     1152 <err_msg_blink+0x32>
mov    %esi,%ebx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0xc350,%edi
mov    $0x7a120,%esi
mov    %ebp,%edx
call   1030 <blinker_n@plt>
add    $0xffffffff,%ebx
je     1152 <err_msg_blink+0x32>
mov    $0x1e8480,%edi
call   1040 <sys_timer_wait@plt>
jmp    1130 <err_msg_blink+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @err_msg_blink(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %2
br label %22
8: ; preds = %2
%9 = load i32, i32* %3
%10 = call i32 @blinker_n(i32 50000, i32 500000, i32 %9)
%11 = load i32, i32* %4
%12 = add i32 %11, -1
store i32 %12, i32* %4
br label %13
13: ; preds = %16, %8
%14 = load i32, i32* %4
%15 = icmp ugt i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = call i32 @sys_timer_wait(i32 2000000)
%18 = load i32, i32* %3
%19 = call i32 @blinker_n(i32 50000, i32 500000, i32 %18)
%20 = load i32, i32* %4
%21 = add i32 %20, -1
store i32 %21, i32* %4
br label %13
22: ; preds = %7, %13
ret void
}

LLVM IR (-O2):
define void @err_msg_blink(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = tail call i32 @blinker_n(i32 50000, i32 500000, i32 %0)
%6 = add i32 %1, -1
%7 = icmp eq i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %4, %8
%9 = phi i32 [ %12, %8 ], [ %6, %4 ]
%10 = tail call i32 @sys_timer_wait(i32 2000000)
%11 = tail call i32 @blinker_n(i32 50000, i32 500000, i32 %0)
%12 = add i32 %9, -1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %8
14: ; preds = %8, %4, %2
ret void
}