#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*/ printf(char *, int);
int random_number(int, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
int main(void) {
  int i = 0;
  srand(time(NULL));
  do {
    printf("Min : 1 Max : 30 = %d\n", random_number(1, 30));
    printf("Min : 100 Max : 1000 = %d\n", random_number(100, 1000));
    usleep(100 * 1000);
    i++;
  } while (i != 30);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x1,%edi
mov    $0x1e,%esi
call   1040 <random_number@plt>
mov    %eax,%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0x3e8,%esi
call   1040 <random_number@plt>
mov    %eax,%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x186a0,%edi
call   1070 <usleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1e,-0x8(%rbp)
jne    1176 <main+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x1e,%ebp
lea    0xe92(%rip),%r14
lea    0xea2(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%edi
mov    $0x1e,%esi
call   1040 <random_number@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0x3e8,%esi
call   1040 <random_number@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x186a0,%edi
call   1070 <usleep@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Min : 1 Max : 30 = %d\0A\00"
@.str.1 = [27 x i8] c"Min : 100 Max : 1000 = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
br label %5
5: ; preds = %13, %0
%6 = call i32 @random_number(i32 1, i32 30)
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @random_number(i32 100, i32 1000)
%9 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @usleep(i32 100000)
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %13
13: ; preds = %5
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 30
br i1 %15, label %5, label %16
16: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Min : 1 Max : 30 = %d\0A\00"
@.str.1 = [27 x i8] c"Min : 100 Max : 1000 = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 0, %0 ], [ %10, %3 ]
%5 = tail call i32 @random_number(i32 1, i32 30)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @random_number(i32 100, i32 1000)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 @usleep(i32 100000)
%10 = add nuw nsw i32 %4, 1
%11 = icmp eq i32 %10, 30
br i1 %11, label %12, label %3
12: ; preds = %3
ret i32 0
}