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


x86 assembly (clang, -O0):
<strobe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x1,0x2f01(%rip)
movb   $0x0,0x2efc(%rip)
movzbl 0x2ef3(%rip),%eax
cmp    $0x0,%eax
je     11b5 <strobe+0x95>
movzbl 0x2ee3(%rip),%edi
call   1030 <led_putnum@plt>
mov    $0x11170,%edi
call   1040 <delay@plt>
cmpb   $0x0,0x2ecf(%rip)
je     117e <strobe+0x5e>
movzbl 0x2ec0(%rip),%eax
sar    $0x1,%eax
mov    %al,0x2eb7(%rip)
jmp    118e <strobe+0x6e>
movzbl 0x2eab(%rip),%eax
shl    $0x1,%eax
mov    %al,0x2ea2(%rip)
movzbl 0x2e9b(%rip),%eax
cmp    $0x80,%eax
jne    11b0 <strobe+0x90>
movzbl 0x2e8b(%rip),%eax
xor    $0xffffffff,%eax
mov    %al,0x2e82(%rip)
jmp    1136 <strobe+0x16>
movb   $0x1,0x2e74(%rip)
movb   $0x0,0x2e6f(%rip)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strobe>:
push   %rax
movb   $0x1,0x2f08(%rip)
mov    $0x1,%cl
xor    %eax,%eax
mov    %al,0x2f00(%rip)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %cl,%edi
call   1030 <led_putnum@plt>
mov    $0x11170,%edi
call   1040 <delay@plt>
movzbl 0x2ed9(%rip),%eax
movzbl 0x2ed0(%rip),%ecx
lea    (%rcx,%rcx,1),%edx
shr    %cl
test   %al,%al
movzbl %dl,%edx
movzbl %cl,%ecx
cmove  %edx,%ecx
mov    %cl,0x2eba(%rip)
test   %cl,%cl
je     1183 <strobe+0x63>
cmp    $0x80,%cl
jne    1140 <strobe+0x20>
not    %al
jmp    112c <strobe+0xc>
movb   $0x1,0x2ea6(%rip)
movb   $0x0,0x2ea1(%rip)
pop    %rcx
ret

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

LLVM IR (-O2):
@strobe.curled = internal unnamed_addr global i8 1
@strobe.dir = internal unnamed_addr global i8 0
define i32 @strobe() {
store i8 1, i8* @strobe.curled
br label %1
1: ; preds = %0, %14
%2 = phi i8 [ %15, %14 ], [ 0, %0 ]
%3 = phi i8 [ %13, %14 ], [ 1, %0 ]
store i8 %2, i8* @strobe.dir
br label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %3, %1 ]
%6 = tail call i32 @led_putnum(i8 zeroext %5)
%7 = tail call i32 @delay(i32 70000)
%8 = load i8, i8* @strobe.dir
%9 = icmp eq i8 %8, 0
%10 = load i8, i8* @strobe.curled
%11 = shl i8 %10, 1
%12 = lshr i8 %10, 1
%13 = select i1 %9, i8 %11, i8 %12
store i8 %13, i8* @strobe.curled
switch i8 %13, label %4 [
i8 -128, label %14
i8 0, label %16
]
14: ; preds = %4
%15 = xor i8 %8, -1
br label %1
16: ; preds = %4
store i8 1, i8* @strobe.curled
store i8 0, i8* @strobe.dir
ret i32 undef
}