#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 rand();
void backLightFlash(unsigned char *red, unsigned char *green,
                    unsigned char *blue) {
  static unsigned int delayCnt = 0;
  if (delayCnt == 10) {
    *red = 0xff & rand();
    *green = 0xff & rand();
    *blue = 0xff & rand();
    delayCnt = 0;
  } else
    delayCnt++;
}


x86 assembly (clang, -O0):
<backLightFlash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xa,0x2f01(%rip)
jne    117c <backLightFlash+0x6c>
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
movl   $0x0,0x2eb5(%rip)
jmp    118b <backLightFlash+0x7b>
mov    0x2eaa(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ea1(%rip)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backLightFlash>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2f0f(%rip),%ebp
cmp    $0xa,%ebp
jne    114c <backLightFlash+0x3c>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,(%r15)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,(%r14)
jmp    114f <backLightFlash+0x3f>
add    $0x1,%ebp
mov    %ebp,0x2ed7(%rip)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@backLightFlash.delayCnt = internal global i32 0
define void @backLightFlash(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* @backLightFlash.delayCnt
%8 = icmp eq i32 %7, 10
br i1 %8, label %9, label %22
9: ; preds = %3
%10 = call i32 (...) @rand()
%11 = and i32 255, %10
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %4
store i8 %12, i8* %13
%14 = call i32 (...) @rand()
%15 = and i32 255, %14
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %5
store i8 %16, i8* %17
%18 = call i32 (...) @rand()
%19 = and i32 255, %18
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %6
store i8 %20, i8* %21
store i32 0, i32* @backLightFlash.delayCnt
br label %25
22: ; preds = %3
%23 = load i32, i32* @backLightFlash.delayCnt
%24 = add i32 %23, 1
store i32 %24, i32* @backLightFlash.delayCnt
br label %25
25: ; preds = %22, %9
ret void
}

LLVM IR (-O2):
@backLightFlash.delayCnt = internal unnamed_addr global i32 0
define void @backLightFlash(i8* nocapture writeonly %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2) {
%4 = load i32, i32* @backLightFlash.delayCnt
%5 = icmp eq i32 %4, 10
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = tail call i32 (...) @rand()
%8 = trunc i32 %7 to i8
store i8 %8, i8* %0
%9 = tail call i32 (...) @rand()
%10 = trunc i32 %9 to i8
store i8 %10, i8* %1
%11 = tail call i32 (...) @rand()
%12 = trunc i32 %11 to i8
store i8 %12, i8* %2
br label %15
13: ; preds = %3
%14 = add i32 %4, 1
br label %15
15: ; preds = %13, %6
%16 = phi i32 [ %14, %13 ], [ 0, %6 ]
store i32 %16, i32* @backLightFlash.delayCnt
ret void
}