#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*/ drv_RB_outw(unsigned char);
int /*<<< orphan*/ ndelay(int const);
void drv_RB_data(const char *string, const int len, const int delay) {
  int l = len;
  unsigned char ch;
  if (len <= 0)
    return;
  while (l--) {
    ch = *(string++);
    drv_RB_outw(ch | 0x0400 | 0x0100);
    ndelay(60);
    drv_RB_outw(ch | 0x0400);
    ndelay(delay * 1000);
  }
}


x86 assembly (clang, -O0):
<drv_RB_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1147 <drv_RB_data+0x27>
jmp    11b6 <drv_RB_data+0x96>
jmp    114c <drv_RB_data+0x2c>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     11b6 <drv_RB_data+0x96>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%eax
or     $0x400,%eax
or     $0x100,%eax
movzbl %al,%edi
call   1030 <drv_RB_outw@plt>
mov    $0x3c,%edi
call   1040 <ndelay@plt>
movzbl -0x15(%rbp),%eax
or     $0x400,%eax
movzbl %al,%edi
call   1030 <drv_RB_outw@plt>
imul   $0x3e8,-0x10(%rbp),%edi
call   1040 <ndelay@plt>
jmp    114c <drv_RB_data+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_RB_data>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
jle    116e <drv_RB_data+0x4e>
mov    %rdi,%r14
imul   $0x3e8,%edx,%r15d
mov    %esi,%r12d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%r14,%rbp,1),%ebx
mov    %ebx,%edi
call   1030 <drv_RB_outw@plt>
mov    $0x3c,%edi
call   1040 <ndelay@plt>
mov    %ebx,%edi
call   1030 <drv_RB_outw@plt>
mov    %r15d,%edi
call   1040 <ndelay@plt>
add    $0x1,%rbp
cmp    %ebp,%r12d
jne    1140 <drv_RB_data+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @drv_RB_data(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
store i32 %9, i32* %7
%10 = load i32, i32* %5
%11 = icmp sle i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
br label %37
13: ; preds = %3
br label %14
14: ; preds = %18, %13
%15 = load i32, i32* %7
%16 = add nsw i32 %15, -1
store i32 %16, i32* %7
%17 = icmp ne i32 %15, 0
br i1 %17, label %18, label %37
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %4
%21 = load i8, i8* %19
store i8 %21, i8* %8
%22 = load i8, i8* %8
%23 = zext i8 %22 to i32
%24 = or i32 %23, 1024
%25 = or i32 %24, 256
%26 = trunc i32 %25 to i8
%27 = call i32 @drv_RB_outw(i8 zeroext %26)
%28 = call i32 @ndelay(i32 60)
%29 = load i8, i8* %8
%30 = zext i8 %29 to i32
%31 = or i32 %30, 1024
%32 = trunc i32 %31 to i8
%33 = call i32 @drv_RB_outw(i8 zeroext %32)
%34 = load i32, i32* %6
%35 = mul nsw i32 %34, 1000
%36 = call i32 @ndelay(i32 %35)
br label %14
37: ; preds = %12, %14
ret void
}

LLVM IR (-O2):
define void @drv_RB_data(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, 1
br i1 %4, label %18, label %5
5: ; preds = %3
%6 = mul nsw i32 %2, 1000
br label %7
7: ; preds = %5, %7
%8 = phi i8* [ %0, %5 ], [ %11, %7 ]
%9 = phi i32 [ %1, %5 ], [ %10, %7 ]
%10 = add nsw i32 %9, -1
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %8
%13 = tail call i32 @drv_RB_outw(i8 zeroext %12)
%14 = tail call i32 @ndelay(i32 60)
%15 = tail call i32 @drv_RB_outw(i8 zeroext %12)
%16 = tail call i32 @ndelay(i32 %6)
%17 = icmp eq i32 %10, 0
br i1 %17, label %18, label %7
18: ; preds = %7, %3
ret void
}