#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(unsigned char);
int /*<<< orphan*/ setLeds(int);
void kitt() {
  char i;
  unsigned char delayTime = 1000000;
  for (i = 0; i < 8; i++) {
    setLeds(i);
    delay(delayTime);
  }
  for (i = 1; i < 7; i++) {
    setLeds(0x80 >> i);
    delay(delayTime);
  }
}


x86 assembly (clang, -O0):
<kitt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x40,-0x2(%rbp)
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x8,%eax
jge    115c <kitt+0x3c>
movsbl -0x1(%rbp),%edi
call   1040 <setLeds@plt>
movzbl -0x2(%rbp),%edi
call   1030 <delay@plt>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    1130 <kitt+0x10>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x7,%eax
jge    1193 <kitt+0x73>
movsbl -0x1(%rbp),%ecx
mov    $0x80,%edi
sar    %cl,%edi
call   1040 <setLeds@plt>
movzbl -0x2(%rbp),%edi
call   1030 <delay@plt>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    1160 <kitt+0x40>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kitt>:
push   %rax
xor    %edi,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x1,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x2,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x3,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x4,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x5,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x6,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x7,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x40,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x20,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x10,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x8,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x4,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
call   1030 <delay@plt>
mov    $0x2,%edi
call   1040 <setLeds@plt>
mov    $0x40,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @kitt() {
%1 = alloca i8
%2 = alloca i8
store i8 64, i8* %2
store i8 0, i8* %1
br label %3
3: ; preds = %13, %0
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 8
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
%10 = call i32 @setLeds(i32 %9)
%11 = load i8, i8* %2
%12 = call i32 @delay(i8 zeroext %11)
br label %13
13: ; preds = %7
%14 = load i8, i8* %1
%15 = add i8 %14, 1
store i8 %15, i8* %1
br label %3
16: ; preds = %3
store i8 1, i8* %1
br label %17
17: ; preds = %28, %16
%18 = load i8, i8* %1
%19 = sext i8 %18 to i32
%20 = icmp slt i32 %19, 7
br i1 %20, label %21, label %31
21: ; preds = %17
%22 = load i8, i8* %1
%23 = sext i8 %22 to i32
%24 = ashr i32 128, %23
%25 = call i32 @setLeds(i32 %24)
%26 = load i8, i8* %2
%27 = call i32 @delay(i8 zeroext %26)
br label %28
28: ; preds = %21
%29 = load i8, i8* %1
%30 = add i8 %29, 1
store i8 %30, i8* %1
br label %17
31: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @kitt() {
%1 = tail call i32 @setLeds(i32 0)
%2 = tail call i32 @delay(i8 zeroext 64)
%3 = tail call i32 @setLeds(i32 1)
%4 = tail call i32 @delay(i8 zeroext 64)
%5 = tail call i32 @setLeds(i32 2)
%6 = tail call i32 @delay(i8 zeroext 64)
%7 = tail call i32 @setLeds(i32 3)
%8 = tail call i32 @delay(i8 zeroext 64)
%9 = tail call i32 @setLeds(i32 4)
%10 = tail call i32 @delay(i8 zeroext 64)
%11 = tail call i32 @setLeds(i32 5)
%12 = tail call i32 @delay(i8 zeroext 64)
%13 = tail call i32 @setLeds(i32 6)
%14 = tail call i32 @delay(i8 zeroext 64)
%15 = tail call i32 @setLeds(i32 7)
%16 = tail call i32 @delay(i8 zeroext 64)
%17 = tail call i32 @setLeds(i32 64)
%18 = tail call i32 @delay(i8 zeroext 64)
%19 = tail call i32 @setLeds(i32 32)
%20 = tail call i32 @delay(i8 zeroext 64)
%21 = tail call i32 @setLeds(i32 16)
%22 = tail call i32 @delay(i8 zeroext 64)
%23 = tail call i32 @setLeds(i32 8)
%24 = tail call i32 @delay(i8 zeroext 64)
%25 = tail call i32 @setLeds(i32 4)
%26 = tail call i32 @delay(i8 zeroext 64)
%27 = tail call i32 @setLeds(i32 2)
%28 = tail call i32 @delay(i8 zeroext 64)
ret void
}