#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;
typedef int uint32_t;

/* Variables and functions */
uint8_t shouldReport(uint32_t total, uint32_t *tainer, int blocksize) {
  if (total == 0)
    blocksize = 1;
  else if (total <= 10)
    blocksize = 10;
  else if (total <= 100)
    blocksize = 100;
  if (total >= *tainer + blocksize) {
    *tainer = total;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<shouldReport>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1124 <shouldReport+0x24>
movl   $0x1,-0x14(%rbp)
jmp    1155 <shouldReport+0x55>
cmpl   $0xa,-0x8(%rbp)
jg     113a <shouldReport+0x3a>
movl   $0xa,-0x14(%rbp)
jmp    1150 <shouldReport+0x50>
cmpl   $0x64,-0x8(%rbp)
jg     114b <shouldReport+0x4b>
movl   $0x64,-0x14(%rbp)
jmp    1150 <shouldReport+0x50>
jmp    1155 <shouldReport+0x55>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jl     117e <shouldReport+0x7e>
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1185 <shouldReport+0x85>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shouldReport>:
test   %edi,%edi
je     111b <shouldReport+0x1b>
mov    $0xa,%ecx
cmp    $0xb,%edi
jl     1120 <shouldReport+0x20>
cmp    $0x65,%edi
mov    $0x64,%ecx
cmovae %edx,%ecx
jmp    1120 <shouldReport+0x20>
mov    $0x1,%ecx
add    (%rsi),%ecx
xor    %eax,%eax
cmp    %edi,%ecx
jg     112f <shouldReport+0x2f>
mov    %edi,(%rsi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @shouldReport(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
store i32 1, i32* %7
br label %21
11: ; preds = %3
%12 = load i32, i32* %5
%13 = icmp sle i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 10, i32* %7
br label %20
15: ; preds = %11
%16 = load i32, i32* %5
%17 = icmp sle i32 %16, 100
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 100, i32* %7
br label %19
19: ; preds = %18, %15
br label %20
20: ; preds = %19, %14
br label %21
21: ; preds = %20, %10
%22 = load i32, i32* %5
%23 = load i32*, i32** %6
%24 = load i32, i32* %23
%25 = load i32, i32* %7
%26 = add nsw i32 %24, %25
%27 = icmp sge i32 %22, %26
br i1 %27, label %28, label %31
28: ; preds = %21
%29 = load i32, i32* %5
%30 = load i32*, i32** %6
store i32 %29, i32* %30
store i32 1, i32* %4
br label %32
31: ; preds = %21
store i32 0, i32* %4
br label %32
32: ; preds = %31, %28
%33 = load i32, i32* %4
ret i32 %33
}

LLVM IR (-O2):
define i32 @shouldReport(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = icmp slt i32 %0, 11
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = icmp ugt i32 %0, 100
%9 = select i1 %8, i32 %2, i32 100
br label %10
10: ; preds = %7, %5, %3
%11 = phi i32 [ 1, %3 ], [ 10, %5 ], [ %9, %7 ]
%12 = load i32, i32* %1
%13 = add nsw i32 %12, %11
%14 = icmp sgt i32 %13, %0
br i1 %14, label %16, label %15
15: ; preds = %10
store i32 %0, i32* %1
br label %16
16: ; preds = %10, %15
%17 = phi i32 [ 1, %15 ], [ 0, %10 ]
ret i32 %17
}