#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 */
unsigned int check_display();
unsigned int progress_length_check();
int /*<<< orphan*/ progress_length_shrink();
int /*<<< orphan*/ progress_printf(unsigned int);
int /*<<< orphan*/ truncate_printf(unsigned int);
void progress_compute(void) {
  unsigned int columns = check_display();
  int truncate = 0;
  while (progress_length_check() > columns) {
    truncate = !progress_length_shrink();
    if (truncate)
      break;
  }
  if (truncate)
    truncate_printf(columns);
  else
    progress_printf(columns);
}


x86 assembly (clang, -O0):
<progress_compute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <check_display@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1070 <progress_length_check@plt>
cmp    -0x4(%rbp),%eax
jbe    11a4 <progress_compute+0x54>
mov    $0x0,%al
call   1060 <progress_length_shrink@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     119f <progress_compute+0x4f>
jmp    11a4 <progress_compute+0x54>
jmp    1169 <progress_compute+0x19>
cmpl   $0x0,-0x8(%rbp)
je     11bb <progress_compute+0x6b>
mov    -0x4(%rbp),%edi
call   1040 <truncate_printf@plt>
jmp    11c3 <progress_compute+0x73>
mov    -0x4(%rbp),%edi
call   1030 <progress_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progress_compute>:
push   %rbx
xor    %eax,%eax
call   1050 <check_display@plt>
mov    %eax,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <progress_length_check@plt>
cmp    %ebx,%eax
jbe    117e <progress_compute+0x2e>
xor    %eax,%eax
call   1060 <progress_length_shrink@plt>
test   %eax,%eax
jne    1160 <progress_compute+0x10>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <truncate_printf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <progress_printf@plt>

LLVM IR (-O0):
define void @progress_compute() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @check_display()
store i32 %3, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %16, %0
%5 = call i32 (...) @progress_length_check()
%6 = load i32, i32* %1
%7 = icmp ugt i32 %5, %6
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = call i32 (...) @progress_length_shrink()
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %8
br label %17
16: ; preds = %8
br label %4
17: ; preds = %15, %4
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %1
%22 = call i32 @truncate_printf(i32 %21)
br label %26
23: ; preds = %17
%24 = load i32, i32* %1
%25 = call i32 @progress_printf(i32 %24)
br label %26
26: ; preds = %23, %20
ret void
}

LLVM IR (-O2):
define void @progress_compute() {
%1 = tail call i32 (...) @check_display()
br label %2
2: ; preds = %5, %0
%3 = tail call i32 (...) @progress_length_check()
%4 = icmp ugt i32 %3, %1
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = tail call i32 (...) @progress_length_shrink()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %5
%9 = tail call i32 @truncate_printf(i32 %1)
br label %12
10: ; preds = %2
%11 = tail call i32 @progress_printf(i32 %1)
br label %12
12: ; preds = %10, %8
ret void
}