#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 rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void do_getRandom_n_m(int n, int m) {
  int i;
  srand((unsigned)time(NULL));
  for (i = 0; i < 10; i++) {
    printf(" %d\n", (rand() % (m - n + 1)) + n);
  }
}


x86 assembly (clang, -O0):
<do_getRandom_n_m>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11a1 <do_getRandom_n_m+0x61>
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    -0x4(%rbp),%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <do_getRandom_n_m+0x25>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_getRandom_n_m>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
sub    %ebx,%ebp
add    $0x1,%ebp
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
lea    0xe91(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
lea    (%rdx,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebp
add    %edx,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" %d\0A\00"
define void @do_getRandom_n_m(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i64 @time(i32* null)
%7 = trunc i64 %6 to i32
%8 = call i32 @srand(i32 %7)
store i32 0, i32* %5
br label %9
9: ; preds = %22, %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = call i32 (...) @rand()
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = sub nsw i32 %14, %15
%17 = add nsw i32 %16, 1
%18 = srem i32 %13, %17
%19 = load i32, i32* %3
%20 = add nsw i32 %18, %19
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %12
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %9
25: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" %d\0A\00"
define void @do_getRandom_n_m(i32 %0, i32 %1) {
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
%6 = sub i32 1, %0
%7 = add i32 %6, %1
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, %7
%10 = add nsw i32 %9, %0
%11 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, %7
%14 = add nsw i32 %13, %0
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, %7
%18 = add nsw i32 %17, %0
%19 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = tail call i32 (...) @rand()
%21 = srem i32 %20, %7
%22 = add nsw i32 %21, %0
%23 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = tail call i32 (...) @rand()
%25 = srem i32 %24, %7
%26 = add nsw i32 %25, %0
%27 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = tail call i32 (...) @rand()
%29 = srem i32 %28, %7
%30 = add nsw i32 %29, %0
%31 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = tail call i32 (...) @rand()
%33 = srem i32 %32, %7
%34 = add nsw i32 %33, %0
%35 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = tail call i32 (...) @rand()
%37 = srem i32 %36, %7
%38 = add nsw i32 %37, %0
%39 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = tail call i32 (...) @rand()
%41 = srem i32 %40, %7
%42 = add nsw i32 %41, %0
%43 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = tail call i32 (...) @rand()
%45 = srem i32 %44, %7
%46 = add nsw i32 %45, %0
%47 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %46)
ret void
}