#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
scalar_t__ do_time(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned long);
int main(void) {
  unsigned long delays = 0;
  int i;
  for (i = 0; i < 100; i++)
    delays += do_time(1000);
  delays = delays / 100;
  if (delays > 2500) {
    printf("Unacceptable long delay; asked for 1000 usec, got %li usec \n",
           delays);
    exit(EXIT_FAILURE);
  }
  delays = 0;
  for (i = 0; i < 100; i++)
    delays += do_time(2000);
  delays = delays / 100;
  if (delays > 3500) {
    printf("Unacceptable long delay; asked for 2000 usec, got %li usec \n",
           delays);
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1178 <main+0x48>
mov    $0x3e8,%edi
call   1030 <do_time@plt>
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <main+0x1e>
mov    -0x10(%rbp),%rax
mov    $0x64,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
cmpq   $0x9c4,-0x10(%rbp)
jbe    11b6 <main+0x86>
mov    -0x10(%rbp),%rsi
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    11ef <main+0xbf>
mov    $0x7d0,%edi
call   1030 <do_time@plt>
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c5 <main+0x95>
mov    -0x10(%rbp),%rax
mov    $0x64,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
cmpq   $0xdac,-0x10(%rbp)
jbe    122d <main+0xfd>
mov    -0x10(%rbp),%rsi
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x64,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x3e8,%edi
call   1030 <do_time@plt>
add    %rax,%rbx
add    $0xffffffff,%ebp
jne    1140 <main+0x10>
cmp    $0x3d0f3,%rbx
jbe    117c <main+0x4c>
shr    $0x2,%rbx
movabs $0x28f5c28f5c28f5c3,%rcx
c2 f5 28
mov    %rbx,%rax
mul    %rcx
shr    $0x2,%rdx
lea    0xe86(%rip),%rdi
jmp    11ca <main+0x9a>
mov    $0x64,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x7d0,%edi
call   1030 <do_time@plt>
add    %rax,%rbx
add    $0xffffffff,%ebp
jne    1190 <main+0x60>
cmp    $0x55794,%rbx
jb     11e0 <main+0xb0>
shr    $0x2,%rbx
movabs $0x28f5c28f5c28f5c3,%rcx
c2 f5 28
mov    %rbx,%rax
mul    %rcx
shr    $0x2,%rdx
lea    0xe73(%rip),%rdi
mov    %rdx,%rsi
call   1040 <printf@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"Unacceptable long delay; asked for 1000 usec, got %li usec \0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [61 x i8] c"Unacceptable long delay; asked for 2000 usec, got %li usec \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = call i64 @do_time(i32 1000)
%9 = load i64, i64* %2
%10 = add i64 %9, %8
store i64 %10, i64* %2
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i64, i64* %2
%16 = udiv i64 %15, 100
store i64 %16, i64* %2
%17 = load i64, i64* %2
%18 = icmp ugt i64 %17, 2500
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i64, i64* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i64 %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %14
store i64 0, i64* %2
store i32 0, i32* %3
br label %25
25: ; preds = %32, %24
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 100
br i1 %27, label %28, label %35
28: ; preds = %25
%29 = call i64 @do_time(i32 2000)
%30 = load i64, i64* %2
%31 = add i64 %30, %29
store i64 %31, i64* %2
br label %32
32: ; preds = %28
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %25
35: ; preds = %25
%36 = load i64, i64* %2
%37 = udiv i64 %36, 100
store i64 %37, i64* %2
%38 = load i64, i64* %2
%39 = icmp ugt i64 %38, 3500
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load i64, i64* %2
%42 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i64 %41)
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %35
%46 = load i32, i32* @EXIT_SUCCESS
%47 = call i32 @exit(i32 %46)
unreachable
}

LLVM IR (-O2):
@.str = [61 x i8] c"Unacceptable long delay; asked for 1000 usec, got %li usec \0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [61 x i8] c"Unacceptable long delay; asked for 2000 usec, got %li usec \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = phi i64 [ 0, %0 ], [ %5, %1 ]
%4 = tail call i64 @do_time(i32 1000)
%5 = add i64 %4, %3
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 100
br i1 %7, label %8, label %1
8: ; preds = %1
%9 = icmp ugt i64 %5, 250099
br i1 %9, label %10, label %15
10: ; preds = %8
%11 = udiv i64 %5, 100
%12 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %8, %15
%16 = phi i32 [ %20, %15 ], [ 0, %8 ]
%17 = phi i64 [ %19, %15 ], [ 0, %8 ]
%18 = tail call i64 @do_time(i32 2000)
%19 = add i64 %18, %17
%20 = add nuw nsw i32 %16, 1
%21 = icmp eq i32 %20, 100
br i1 %21, label %22, label %15
22: ; preds = %15
%23 = icmp ugt i64 %19, 350099
br i1 %23, label %24, label %29
24: ; preds = %22
%25 = udiv i64 %19, 100
%26 = tail call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i64 %25)
%27 = load i32, i32* @EXIT_FAILURE
%28 = tail call i32 @exit(i32 %27)
unreachable
29: ; preds = %22
%30 = load i32, i32* @EXIT_SUCCESS
%31 = tail call i32 @exit(i32 %30)
unreachable
}