#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*/ assert(int);
int random_int(int);
int random_int2(int, int);
void run_tests() {
  for (int i = 0; i < 1000; i++) {
    int r1 = random_int(20);
    assert(0 <= r1 && r1 < 20);
    int r2 = random_int2(20, 40);
    assert(20 <= r2 && r2 <= 40);
  }
}


x86 assembly (clang, -O0):
<run_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x3e8,-0x4(%rbp)
jge    11ca <run_tests+0x9a>
mov    $0x14,%edi
call   1050 <random_int@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x8(%rbp),%ecx
mov    %al,-0xd(%rbp)
jg     1173 <run_tests+0x43>
cmpl   $0x14,-0x8(%rbp)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x14,%edi
mov    $0x28,%esi
call   1030 <random_int2@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
mov    $0x14,%ecx
cmp    -0xc(%rbp),%ecx
mov    %al,-0xe(%rbp)
jg     11af <run_tests+0x7f>
cmpl   $0x28,-0xc(%rbp)
setle  %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <run_tests+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_tests>:
push   %rbx
mov    $0x3e8,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x14,%edi
call   1050 <random_int@plt>
xor    %edi,%edi
cmp    $0x14,%eax
setb   %dil
call   1040 <assert@plt>
mov    $0x14,%edi
mov    $0x28,%esi
call   1030 <random_int2@plt>
add    $0xffffffec,%eax
xor    %edi,%edi
cmp    $0x15,%eax
setb   %dil
call   1040 <assert@plt>
add    $0xffffffff,%ebx
jne    1140 <run_tests+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @run_tests() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %28, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %31
7: ; preds = %4
%8 = call i32 @random_int(i32 20)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp sle i32 0, %9
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 20
br label %14
14: ; preds = %11, %7
%15 = phi i1 [ false, %7 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @random_int2(i32 20, i32 40)
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp sle i32 20, %19
br i1 %20, label %21, label %24
21: ; preds = %14
%22 = load i32, i32* %3
%23 = icmp sle i32 %22, 40
br label %24
24: ; preds = %21, %14
%25 = phi i1 [ false, %14 ], [ %23, %21 ]
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
br label %28
28: ; preds = %24
%29 = load i32, i32* %1
%30 = add nsw i32 %29, 1
store i32 %30, i32* %1
br label %4
31: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @run_tests() {
br label %2
1: ; preds = %2
ret void
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %13, %2 ]
%4 = tail call i32 @random_int(i32 20)
%5 = icmp ult i32 %4, 20
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @random_int2(i32 20, i32 40)
%9 = add i32 %8, -20
%10 = icmp ult i32 %9, 21
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = add nuw nsw i32 %3, 1
%14 = icmp eq i32 %13, 1000
br i1 %14, label %1, label %2
}