#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 */
scalar_t__ TimedTask_canRun(int, int);
int /*<<< orphan*/ printf(char *, int, int);
int rand();
int main(void) {
  uint8_t t, i;
  uint8_t runTime = 0;
  for (i = 0; i < 4; i++) {
    for (t = 3; t < 255; t++) {
      if (TimedTask_canRun(runTime, t)) {
        printf("t: %3u runTime: %3u\n", t, runTime);
        runTime += 10;
      }
      if (rand() % 100 > 75)
        t += 3;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11e2 <main+0xb2>
movl   $0x3,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jge    11cf <main+0x9f>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <TimedTask_canRun@plt>
cmp    $0x0,%rax
je     119b <main+0x6b>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x4b,%edx
jle    11bc <main+0x8c>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
jmp    11c1 <main+0x91>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115e <main+0x2e>
jmp    11d4 <main+0xa4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x3,%ebx
lea    0xec0(%rip),%r14
xor    %ebp,%ebp
jmp    1186 <main+0x56>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
lea    0x3(%rbx),%ecx
cmp    $0x4c,%eax
cmovl  %ebx,%ecx
lea    0x1(%rcx),%ebx
cmp    $0xfe,%ecx
jge    11a5 <main+0x75>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <TimedTask_canRun@plt>
test   %rax,%rax
je     1150 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
add    $0xa,%ebp
jmp    1150 <main+0x20>
mov    $0x3,%ebx
lea    0xe4f(%rip),%r14
jmp    11f6 <main+0xc6>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
lea    0x3(%rbx),%ecx
cmp    $0x4c,%eax
cmovl  %ebx,%ecx
lea    0x1(%rcx),%ebx
cmp    $0xfe,%ecx
jge    1215 <main+0xe5>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <TimedTask_canRun@plt>
test   %rax,%rax
je     11c0 <main+0x90>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
add    $0xa,%ebp
jmp    11c0 <main+0x90>
mov    $0x3,%ebx
lea    0xddf(%rip),%r14
jmp    1266 <main+0x136>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
lea    0x3(%rbx),%ecx
cmp    $0x4c,%eax
cmovl  %ebx,%ecx
lea    0x1(%rcx),%ebx
cmp    $0xfe,%ecx
jge    1285 <main+0x155>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <TimedTask_canRun@plt>
test   %rax,%rax
je     1230 <main+0x100>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
add    $0xa,%ebp
jmp    1230 <main+0x100>
mov    $0x3,%ebx
lea    0xd6f(%rip),%r14
jmp    12d6 <main+0x1a6>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
lea    0x3(%rbx),%ecx
cmp    $0x4c,%eax
cmovl  %ebx,%ecx
lea    0x1(%rcx),%ebx
cmp    $0xfe,%ecx
jge    12f5 <main+0x1c5>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <TimedTask_canRun@plt>
test   %rax,%rax
je     12a0 <main+0x170>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <printf@plt>
add    $0xa,%ebp
jmp    12a0 <main+0x170>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"t: %3u runTime: %3u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %35, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %38
8: ; preds = %5
store i32 3, i32* %2
br label %9
9: ; preds = %31, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 255
br i1 %11, label %12, label %34
12: ; preds = %9
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = call i64 @TimedTask_canRun(i32 %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i32, i32* %2
%19 = load i32, i32* %4
%20 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19)
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 10
store i32 %22, i32* %4
br label %23
23: ; preds = %17, %12
%24 = call i32 (...) @rand()
%25 = srem i32 %24, 100
%26 = icmp sgt i32 %25, 75
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 3
store i32 %29, i32* %2
br label %30
30: ; preds = %27, %23
br label %31
31: ; preds = %30
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %9
34: ; preds = %9
br label %35
35: ; preds = %34
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %5
38: ; preds = %5
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [21 x i8] c"t: %3u runTime: %3u\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %9
%2 = phi i32 [ 0, %0 ], [ %10, %9 ]
%3 = phi i32 [ 3, %0 ], [ %16, %9 ]
%4 = tail call i64 @TimedTask_canRun(i32 %2, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %2)
%8 = add nsw i32 %2, 10
br label %9
9: ; preds = %6, %1
%10 = phi i32 [ %8, %6 ], [ %2, %1 ]
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 100
%13 = icmp sgt i32 %12, 75
%14 = add nsw i32 %3, 3
%15 = select i1 %13, i32 %14, i32 %3
%16 = add nsw i32 %15, 1
%17 = icmp slt i32 %15, 254
br i1 %17, label %1, label %18
18: ; preds = %9, %26
%19 = phi i32 [ %27, %26 ], [ %10, %9 ]
%20 = phi i32 [ %33, %26 ], [ 3, %9 ]
%21 = tail call i64 @TimedTask_canRun(i32 %19, i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %18
%24 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %19)
%25 = add nsw i32 %19, 10
br label %26
26: ; preds = %23, %18
%27 = phi i32 [ %25, %23 ], [ %19, %18 ]
%28 = tail call i32 (...) @rand()
%29 = srem i32 %28, 100
%30 = icmp sgt i32 %29, 75
%31 = add nsw i32 %20, 3
%32 = select i1 %30, i32 %31, i32 %20
%33 = add nsw i32 %32, 1
%34 = icmp slt i32 %32, 254
br i1 %34, label %18, label %35
35: ; preds = %26, %43
%36 = phi i32 [ %44, %43 ], [ %27, %26 ]
%37 = phi i32 [ %50, %43 ], [ 3, %26 ]
%38 = tail call i64 @TimedTask_canRun(i32 %36, i32 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %35
%41 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %37, i32 %36)
%42 = add nsw i32 %36, 10
br label %43
43: ; preds = %40, %35
%44 = phi i32 [ %42, %40 ], [ %36, %35 ]
%45 = tail call i32 (...) @rand()
%46 = srem i32 %45, 100
%47 = icmp sgt i32 %46, 75
%48 = add nsw i32 %37, 3
%49 = select i1 %47, i32 %48, i32 %37
%50 = add nsw i32 %49, 1
%51 = icmp slt i32 %49, 254
br i1 %51, label %35, label %52
52: ; preds = %43, %60
%53 = phi i32 [ %61, %60 ], [ %44, %43 ]
%54 = phi i32 [ %67, %60 ], [ 3, %43 ]
%55 = tail call i64 @TimedTask_canRun(i32 %53, i32 %54)
%56 = icmp eq i64 %55, 0
br i1 %56, label %60, label %57
57: ; preds = %52
%58 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %54, i32 %53)
%59 = add nsw i32 %53, 10
br label %60
60: ; preds = %57, %52
%61 = phi i32 [ %59, %57 ], [ %53, %52 ]
%62 = tail call i32 (...) @rand()
%63 = srem i32 %62, 100
%64 = icmp sgt i32 %63, 75
%65 = add nsw i32 %54, 3
%66 = select i1 %64, i32 %65, i32 %54
%67 = add nsw i32 %66, 1
%68 = icmp slt i32 %66, 254
br i1 %68, label %52, label %69
69: ; preds = %60
ret i32 0
}