#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*/ STDOUT_FILENO;
int strlen(char *);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void travail() {
  const int width = 70;
  int i, x = 0;
  char msg[] = "/\\";
  int incr = +1;
  for (;;) {
    write(STDOUT_FILENO, "\r", 1);
    usleep(100000);
    for (i = 0; i < x; i++)
      write(STDOUT_FILENO, "_", 1);
    write(STDOUT_FILENO, msg, strlen(msg));
    for (i = 0; i < width - x; i++)
      write(STDOUT_FILENO, "_", 1);
    x += incr;
    if (x == width)
      incr = -1;
    if (x == 0)
      incr = +1;
  }
}


x86 assembly (clang, -O0):
<travail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x46,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0xeb3(%rip),%ax
mov    %ax,-0xf(%rbp)
mov    0xeab(%rip),%al
mov    %al,-0xd(%rbp)
movl   $0x1,-0x14(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1050 <usleep@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c0 <travail+0x90>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118c <travail+0x5c>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
lea    -0xf(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xf(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x46,%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    122d <travail+0xfd>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
lea    0xdf0(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f2 <travail+0xc2>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x46,-0xc(%rbp)
jne    1247 <travail+0x117>
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1258 <travail+0x128>
movl   $0x1,-0x14(%rbp)
jmp    1161 <travail+0x31>

x86 assembly (clang, -O2):
<travail>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x0,0x6(%rsp)
movw   $0x5c2f,0x4(%rsp)
xor    %r12d,%r12d
mov    0x2e9f(%rip),%rbp
lea    0xead(%rip),%r15
mov    $0x1,%r14d
jmp    1183 <travail+0x53>
lea    (%r14,%r12,1),%eax
cmp    $0x46,%eax
mov    %r14d,%eax
mov    $0xffffffff,%ecx
cmove  %ecx,%eax
add    %r12d,%r14d
mov    $0x1,%ecx
cmove  %ecx,%eax
mov    %r14d,%r12d
mov    %eax,%r14d
mov    0x0(%rbp),%edi
lea    0xe76(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1050 <usleep@plt>
test   %r12d,%r12d
jle    11c5 <travail+0x95>
mov    %r12d,%ebx
nopl   0x0(%rax)
mov    0x0(%rbp),%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0xffffffff,%ebx
jne    11b0 <travail+0x80>
mov    0x0(%rbp),%r13d
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
cmp    $0x45,%r12d
jg     1160 <travail+0x30>
mov    $0x46,%ebx
sub    %r12d,%ebx
cmp    $0x2,%ebx
mov    $0x1,%eax
cmovl  %eax,%ebx
mov    0x0(%rbp),%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0xffffffff,%ebx
jne    1200 <travail+0xd0>
jmp    1160 <travail+0x30>

LLVM IR (-O0):
@__const.travail.msg = [3 x i8] c"/\\\00"
@STDOUT_FILENO = global i32 0
@.str = [2 x i8] c"\0D\00"
@.str.1 = [2 x i8] c"_\00"
define void @travail() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x i8]
%5 = alloca i32
store i32 70, i32* %1
store i32 0, i32* %3
%6 = bitcast [3 x i8]* %4 to i8*
store i32 1, i32* %5
br label %7
7: ; preds = %49, %0
%8 = load i32, i32* @STDOUT_FILENO
%9 = call i32 @write(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = call i32 @usleep(i32 100000)
store i32 0, i32* %2
br label %11
11: ; preds = %18, %7
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i32, i32* @STDOUT_FILENO
%17 = call i32 @write(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %18
18: ; preds = %15
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %11
21: ; preds = %11
%22 = load i32, i32* @STDOUT_FILENO
%23 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = call i32 @write(i32 %22, i8* %23, i32 %25)
store i32 0, i32* %2
br label %27
27: ; preds = %35, %21
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = sub nsw i32 70, %29
%31 = icmp slt i32 %28, %30
br i1 %31, label %32, label %38
32: ; preds = %27
%33 = load i32, i32* @STDOUT_FILENO
%34 = call i32 @write(i32 %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %35
35: ; preds = %32
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %27
38: ; preds = %27
%39 = load i32, i32* %5
%40 = load i32, i32* %3
%41 = add nsw i32 %40, %39
store i32 %41, i32* %3
%42 = load i32, i32* %3
%43 = icmp eq i32 %42, 70
br i1 %43, label %44, label %45
44: ; preds = %38
store i32 -1, i32* %5
br label %45
45: ; preds = %44, %38
%46 = load i32, i32* %3
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %45
store i32 1, i32* %5
br label %49
49: ; preds = %48, %45
br label %7
}

LLVM IR (-O2):
@__const.travail.msg = [3 x i8] c"/\\\00"
@STDOUT_FILENO = global i32 0
@.str = [2 x i8] c"\0D\00"
@.str.1 = [2 x i8] c"_\00"
define void @travail() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %30, %0
%4 = phi i32 [ 0, %0 ], [ %31, %30 ]
%5 = phi i32 [ 1, %0 ], [ %35, %30 ]
%6 = load i32, i32* @STDOUT_FILENO
%7 = call i32 @write(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%8 = call i32 @usleep(i32 100000)
%9 = icmp sgt i32 %4, 0
br i1 %9, label %10, label %16
10: ; preds = %3, %10
%11 = phi i32 [ %14, %10 ], [ 0, %3 ]
%12 = load i32, i32* @STDOUT_FILENO
%13 = call i32 @write(i32 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%14 = add nuw nsw i32 %11, 1
%15 = icmp eq i32 %14, %4
br i1 %15, label %16, label %10
16: ; preds = %10, %3
%17 = load i32, i32* @STDOUT_FILENO
%18 = call i32 @strlen(i8* %2)
%19 = call i32 @write(i32 %17, i8* %2, i32 %18)
%20 = icmp slt i32 %4, 70
br i1 %20, label %21, label %30
21: ; preds = %16
%22 = sub i32 70, %4
%23 = call i32 @llvm.smax.i32(i32 %22, i32 1)
br label %24
24: ; preds = %21, %24
%25 = phi i32 [ %28, %24 ], [ 0, %21 ]
%26 = load i32, i32* @STDOUT_FILENO
%27 = call i32 @write(i32 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%28 = add nuw nsw i32 %25, 1
%29 = icmp eq i32 %28, %23
br i1 %29, label %30, label %24
30: ; preds = %24, %16
%31 = add nsw i32 %5, %4
%32 = icmp eq i32 %31, 70
%33 = select i1 %32, i32 -1, i32 %5
%34 = icmp eq i32 %31, 0
%35 = select i1 %34, i32 1, i32 %33
br label %3
}