#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(int);
int /*<<< orphan*/ led_putnum(unsigned char);
void strobe() {
  static unsigned char curled;
  static unsigned char dir;
  curled = 1;
  dir = 0;
  while (curled != 0) {
    led_putnum(curled);
    delay(70000);
    if (dir)
      curled >>= 1;
    else
      curled <<= 1;
    if (curled == 0x100) {
      dir = ~dir;
    }
  }
  curled = 1;
  dir = 0;
}


x86 assembly (clang, -O0):
<strobe>:
push   %rbp
mov    %rsp,%rbp
movb   $0x1,0x2f06(%rip)
movb   $0x0,0x2f00(%rip)
movzbl 0x2ef8(%rip),%eax
cmp    $0x0,%eax
je     11b1 <strobe+0x91>
movzbl 0x2ee8(%rip),%edi
call   1030 <led_putnum@plt>
mov    $0x11170,%edi
call   1040 <delay@plt>
cmpb   $0x0,0x2ed3(%rip)
je     117a <strobe+0x5a>
movzbl 0x2ec5(%rip),%eax
sar    $0x1,%eax
mov    %al,0x2ebc(%rip)
jmp    118a <strobe+0x6a>
movzbl 0x2eb0(%rip),%eax
shl    $0x1,%eax
mov    %al,0x2ea7(%rip)
movzbl 0x2ea0(%rip),%eax
cmp    $0x100,%eax
jne    11ac <strobe+0x8c>
movzbl 0x2e8f(%rip),%eax
xor    $0xffffffff,%eax
mov    %al,0x2e86(%rip)
jmp    1132 <strobe+0x12>
movb   $0x1,0x2e79(%rip)
movb   $0x0,0x2e73(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<strobe>:
push   %rax
movb   $0x1,0x2f09(%rip)
mov    $0x1,%al
nopw   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1030 <led_putnum@plt>
mov    $0x11170,%edi
call   1040 <delay@plt>
movzbl 0x2ee8(%rip),%eax
add    %al,%al
mov    %al,0x2ee0(%rip)
jne    1130 <strobe+0x10>
movb   $0x1,0x2ed7(%rip)
pop    %rax
ret

LLVM IR (-O0):
@strobe.curled = internal global i8 0
@strobe.dir = internal global i8 0
define void @strobe() {
store i8 1, i8* @strobe.curled
store i8 0, i8* @strobe.dir
br label %1
1: ; preds = %30, %0
%2 = load i8, i8* @strobe.curled
%3 = zext i8 %2 to i32
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %31
5: ; preds = %1
%6 = load i8, i8* @strobe.curled
%7 = call i32 @led_putnum(i8 zeroext %6)
%8 = call i32 @delay(i32 70000)
%9 = load i8, i8* @strobe.dir
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = load i8, i8* @strobe.curled
%13 = zext i8 %12 to i32
%14 = ashr i32 %13, 1
%15 = trunc i32 %14 to i8
store i8 %15, i8* @strobe.curled
br label %21
16: ; preds = %5
%17 = load i8, i8* @strobe.curled
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 1
%20 = trunc i32 %19 to i8
store i8 %20, i8* @strobe.curled
br label %21
21: ; preds = %16, %11
%22 = load i8, i8* @strobe.curled
%23 = zext i8 %22 to i32
%24 = icmp eq i32 %23, 256
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i8, i8* @strobe.dir
%27 = zext i8 %26 to i32
%28 = xor i32 %27, -1
%29 = trunc i32 %28 to i8
store i8 %29, i8* @strobe.dir
br label %30
30: ; preds = %25, %21
br label %1
31: ; preds = %1
store i8 1, i8* @strobe.curled
store i8 0, i8* @strobe.dir
ret void
}

LLVM IR (-O2):
@strobe.curled = internal unnamed_addr global i8 0
define void @strobe() {
store i8 1, i8* @strobe.curled
br label %1
1: ; preds = %0, %1
%2 = phi i8 [ 1, %0 ], [ %6, %1 ]
%3 = tail call i32 @led_putnum(i8 zeroext %2)
%4 = tail call i32 @delay(i32 70000)
%5 = load i8, i8* @strobe.curled
%6 = shl i8 %5, 1
store i8 %6, i8* @strobe.curled
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %1
8: ; preds = %1
store i8 1, i8* @strobe.curled
ret void
}