#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ stdout;
void progress(void) {
  static uint8_t progct;
  static uint8_t scalect;
  if (++scalect == 16) {
    scalect = 0;
    printf("%c\010", "-\\|/"[progct++ & 3]);
    fflush(stdout);
  }
}


x86 assembly (clang, -O0):
<progress>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f0e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f05(%rip)
cmp    $0x10,%eax
jne    1182 <progress+0x62>
movl   $0x0,0x2ef2(%rip)
mov    0x2ee8(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2edd(%rip)
and    $0x3,%eax
movslq %eax,%rcx
lea    0xe9c(%rip),%rdi
lea    0xe99(%rip),%rax
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<progress>:
push   %rax
mov    0x2f11(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f08(%rip)
cmp    $0x10,%eax
jne    1177 <progress+0x57>
movl   $0x0,0x2ef9(%rip)
mov    0x2eef(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2ee6(%rip)
and    $0x3,%eax
lea    0xeac(%rip),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>
pop    %rax
ret

LLVM IR (-O0):
@progress.progct = internal global i32 0
@progress.scalect = internal global i32 0
@.str = [4 x i8] c"%c\08\00"
@.str.1 = [5 x i8] c"-\\|/\00"
@stdout = global i32 0
define void @progress() {
%1 = load i32, i32* @progress.scalect
%2 = add nsw i32 %1, 1
store i32 %2, i32* @progress.scalect
%3 = icmp eq i32 %2, 16
br i1 %3, label %4, label %14
4: ; preds = %0
store i32 0, i32* @progress.scalect
%5 = load i32, i32* @progress.progct
%6 = add nsw i32 %5, 1
store i32 %6, i32* @progress.progct
%7 = and i32 %5, 3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [5 x i8], [5 x i8]* @.str.1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %10)
%12 = load i32, i32* @stdout
%13 = call i32 @fflush(i32 %12)
br label %14
14: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@progress.progct = internal unnamed_addr global i32 0
@progress.scalect = internal unnamed_addr global i32 0
@.str = [4 x i8] c"%c\08\00"
@.str.1 = [5 x i8] c"-\\|/\00"
@stdout = global i32 0
define void @progress() {
%1 = load i32, i32* @progress.scalect
%2 = add nsw i32 %1, 1
store i32 %2, i32* @progress.scalect
%3 = icmp eq i32 %2, 16
br i1 %3, label %4, label %14
4: ; preds = %0
store i32 0, i32* @progress.scalect
%5 = load i32, i32* @progress.progct
%6 = add nsw i32 %5, 1
store i32 %6, i32* @progress.progct
%7 = and i32 %5, 3
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [5 x i8], [5 x i8]* @.str.1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %10)
%12 = load i32, i32* @stdout
%13 = tail call i32 @fflush(i32 %12)
br label %14
14: ; preds = %4, %0
ret void
}