#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 */
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int /*<<< orphan*/ board_timer(unsigned int);
int /*<<< orphan*/ print_segment(unsigned long long);
unsigned long long to_segment(char *);
void ticker_segment(char *x, unsigned int speed) {
  unsigned int size = (sizeof(x) / 8);
  long long unsigned int display = to_segment(x);
  for (unsigned int i = 0; i <= 6 + size; i++) {
    if (i <= size) {
      print_segment(display >> (8 * (size - i)));
    } else {
      print_segment(display << (8 * (i - size)));
    }
    board_timer(speed);
  }
}


x86 assembly (clang, -O0):
<ticker_segment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <to_segment@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x6,%ecx
cmp    %ecx,%eax
ja     11c4 <ticker_segment+0x94>
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
ja     1195 <ticker_segment+0x65>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%eax
sub    -0x1c(%rbp),%eax
shl    $0x3,%eax
mov    %eax,%eax
mov    %eax,%ecx
shr    %cl,%rdi
call   1040 <print_segment@plt>
jmp    11ae <ticker_segment+0x7e>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%eax
sub    -0x10(%rbp),%eax
shl    $0x3,%eax
mov    %eax,%eax
mov    %eax,%ecx
shl    %cl,%rdi
call   1040 <print_segment@plt>
mov    -0xc(%rbp),%edi
call   1030 <board_timer@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115a <ticker_segment+0x2a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ticker_segment>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1050 <to_segment@plt>
mov    %rax,%rbx
mov    %rax,%rdi
shr    $0x8,%rdi
call   1040 <print_segment@plt>
mov    %ebp,%edi
call   1030 <board_timer@plt>
mov    %rbx,%rdi
call   1040 <print_segment@plt>
mov    %ebp,%edi
call   1030 <board_timer@plt>
mov    %rbx,%rdi
shl    $0x8,%rdi
call   1040 <print_segment@plt>
mov    %ebp,%edi
call   1030 <board_timer@plt>
mov    %rbx,%rdi
shl    $0x10,%rdi
call   1040 <print_segment@plt>
mov    %ebp,%edi
call   1030 <board_timer@plt>
mov    %rbx,%rdi
shl    $0x18,%rdi
call   1040 <print_segment@plt>
mov    %ebp,%edi
call   1030 <board_timer@plt>
mov    %rbx,%rdi
shl    $0x20,%rdi
call   1040 <print_segment@plt>
mov    %ebp,%edi
call   1030 <board_timer@plt>
mov    %rbx,%rdi
shl    $0x28,%rdi
call   1040 <print_segment@plt>
mov    %ebp,%edi
call   1030 <board_timer@plt>
shl    $0x30,%rbx
mov    %rbx,%rdi
call   1040 <print_segment@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <board_timer@plt>

LLVM IR (-O0):
define void @ticker_segment(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 1, i32* %5
%8 = load i8*, i8** %3
%9 = call i64 @to_segment(i8* %8)
store i64 %9, i64* %6
store i32 0, i32* %7
br label %10
10: ; preds = %40, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = add i32 6, %12
%14 = icmp ule i32 %11, %13
br i1 %14, label %15, label %43
15: ; preds = %10
%16 = load i32, i32* %7
%17 = load i32, i32* %5
%18 = icmp ule i32 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i64, i64* %6
%21 = load i32, i32* %5
%22 = load i32, i32* %7
%23 = sub i32 %21, %22
%24 = mul i32 8, %23
%25 = zext i32 %24 to i64
%26 = lshr i64 %20, %25
%27 = call i32 @print_segment(i64 %26)
br label %37
28: ; preds = %15
%29 = load i64, i64* %6
%30 = load i32, i32* %7
%31 = load i32, i32* %5
%32 = sub i32 %30, %31
%33 = mul i32 8, %32
%34 = zext i32 %33 to i64
%35 = shl i64 %29, %34
%36 = call i32 @print_segment(i64 %35)
br label %37
37: ; preds = %28, %19
%38 = load i32, i32* %4
%39 = call i32 @board_timer(i32 %38)
br label %40
40: ; preds = %37
%41 = load i32, i32* %7
%42 = add i32 %41, 1
store i32 %42, i32* %7
br label %10
43: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @ticker_segment(i8* %0, i32 %1) {
%3 = tail call i64 @to_segment(i8* %0)
%4 = lshr i64 %3, 8
%5 = tail call i32 @print_segment(i64 %4)
%6 = tail call i32 @board_timer(i32 %1)
%7 = tail call i32 @print_segment(i64 %3)
%8 = tail call i32 @board_timer(i32 %1)
%9 = shl i64 %3, 8
%10 = tail call i32 @print_segment(i64 %9)
%11 = tail call i32 @board_timer(i32 %1)
%12 = shl i64 %3, 16
%13 = tail call i32 @print_segment(i64 %12)
%14 = tail call i32 @board_timer(i32 %1)
%15 = shl i64 %3, 24
%16 = tail call i32 @print_segment(i64 %15)
%17 = tail call i32 @board_timer(i32 %1)
%18 = shl i64 %3, 32
%19 = tail call i32 @print_segment(i64 %18)
%20 = tail call i32 @board_timer(i32 %1)
%21 = shl i64 %3, 40
%22 = tail call i32 @print_segment(i64 %21)
%23 = tail call i32 @board_timer(i32 %1)
%24 = shl i64 %3, 48
%25 = tail call i32 @print_segment(i64 %24)
%26 = tail call i32 @board_timer(i32 %1)
ret void
}