#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 */
long PaConvert_TriangularDither();
int /*<<< orphan*/ printf(char *, long, long, long, long);
int main(void) {
  long max, min;
  int i;
  for (i = 0; i < 10000; i++) {
    long dither = PaConvert_TriangularDither();
    if (dither < min)
      min = dither;
    else if (dither > max)
      max = dither;
  }
  printf("min = 0x%08X = %d, max = 0x%08X = %d\n", min, min, max, max);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2710,-0x1c(%rbp)
jge    1197 <main+0x77>
mov    $0x0,%al
call   1040 <PaConvert_TriangularDither@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1169 <main+0x49>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1184 <main+0x64>
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    117f <main+0x5f>
mov    -0x28(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1184 <main+0x64>
jmp    1189 <main+0x69>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1136 <main+0x16>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x2710,%ebp
nopl   0x0(%rax)
mov    %rbx,%r15
xor    %eax,%eax
call   1040 <PaConvert_TriangularDither@plt>
cmp    %rbx,%rax
cmovg  %rax,%rbx
cmp    %r14,%rax
cmovl  %rax,%r14
cmovl  %r15,%rbx
add    $0xffffffff,%ebp
jne    1130 <main+0x10>
lea    0xea8(%rip),%rdi
mov    %r14,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"min = 0x%08X = %d, max = 0x%08X = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %4
br label %6
6: ; preds = %24, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 10000
br i1 %8, label %9, label %27
9: ; preds = %6
%10 = call i64 (...) @PaConvert_TriangularDither()
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = load i64, i64* %3
%13 = icmp slt i64 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = load i64, i64* %5
store i64 %15, i64* %3
br label %23
16: ; preds = %9
%17 = load i64, i64* %5
%18 = load i64, i64* %2
%19 = icmp sgt i64 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i64, i64* %5
store i64 %21, i64* %2
br label %22
22: ; preds = %20, %16
br label %23
23: ; preds = %22, %14
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %6
27: ; preds = %6
%28 = load i64, i64* %3
%29 = load i64, i64* %3
%30 = load i64, i64* %2
%31 = load i64, i64* %2
%32 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 %28, i64 %29, i64 %30, i64 %31)
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [38 x i8] c"min = 0x%08X = %d, max = 0x%08X = %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ undef, %0 ], [ %10, %1 ]
%3 = phi i32 [ 0, %0 ], [ %11, %1 ]
%4 = phi i64 [ undef, %0 ], [ %9, %1 ]
%5 = tail call i64 (...) @PaConvert_TriangularDither()
%6 = icmp slt i64 %5, %4
%7 = icmp sgt i64 %5, %2
%8 = select i1 %7, i64 %5, i64 %2
%9 = select i1 %6, i64 %5, i64 %4
%10 = select i1 %6, i64 %2, i64 %8
%11 = add nuw nsw i32 %3, 1
%12 = icmp eq i32 %11, 10000
br i1 %12, label %13, label %1
13: ; preds = %1
%14 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 %9, i64 %9, i64 %10, i64 %10)
ret i32 0
}