#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 atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int n_arguments = argc;
  char **arguments = argv;
  if (n_arguments != 4) {
    printf("Wrong number of arguments!\n");
    printf("Usage: %s number_of_numbers minimum maximum\n", argv[0]);
    return 1;
  } else {
    srand(time(NULL));
    int i = 0;
    int number = atoi(arguments[1]);
    int minimum = atoi(arguments[2]);
    int maximum = atoi(arguments[3]);
    for (i; i < number; i++) {
      printf("%i\n", rand() % (maximum - minimum + 1) + minimum);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x4,-0x14(%rbp)
je     11ad <main+0x5d>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1240 <main+0xf0>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1234 <main+0xe4>
mov    $0x0,%al
call   1070 <rand@plt>
mov    -0x30(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    -0x2c(%rbp),%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f4 <main+0xa4>
jmp    1239 <main+0xe9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
cmp    $0x4,%edi
jne    11e2 <main+0x82>
xor    %ebx,%ebx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    0x8(%r15),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%r15),%rdi
call   1070 <atoi@plt>
test   %ebp,%ebp
jle    1204 <main+0xa4>
mov    %eax,%r14d
mov    0x18(%r15),%rdi
call   1070 <atoi@plt>
mov    %eax,%r15d
sub    %r14d,%r15d
add    $0x1,%r15d
lea    0xe78(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %r15d
lea    (%rdx,%r14,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    11c0 <main+0x60>
jmp    1204 <main+0xa4>
lea    0xe48(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%rsi
lea    0xe08(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Wrong number of arguments!\0A\00"
@.str.1 = [45 x i8] c"Usage: %s number_of_numbers minimum maximum\0A\00"
@.str.2 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
store i32 %12, i32* %6
%13 = load i8**, i8*** %5
store i8** %13, i8*** %7
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 4
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %20)
store i32 1, i32* %3
br label %57
22: ; preds = %2
%23 = call i32 @time(i32* null)
%24 = call i32 @srand(i32 %23)
store i32 0, i32* %8
%25 = load i8**, i8*** %7
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %9
%29 = load i8**, i8*** %7
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %10
%33 = load i8**, i8*** %7
%34 = getelementptr inbounds i8*, i8** %33, i64 3
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
store i32 %36, i32* %11
%37 = load i32, i32* %8
br label %38
38: ; preds = %52, %22
%39 = load i32, i32* %8
%40 = load i32, i32* %9
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %55
42: ; preds = %38
%43 = call i32 (...) @rand()
%44 = load i32, i32* %11
%45 = load i32, i32* %10
%46 = sub nsw i32 %44, %45
%47 = add nsw i32 %46, 1
%48 = srem i32 %43, %47
%49 = load i32, i32* %10
%50 = add nsw i32 %48, %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %42
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
br label %38
55: ; preds = %38
br label %56
56: ; preds = %55
store i32 0, i32* %3
br label %57
57: ; preds = %56, %16
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@.str.1 = [45 x i8] c"Usage: %s number_of_numbers minimum maximum\0A\00"
@.str.2 = [4 x i8] c"%i\0A\00"
@str = [27 x i8] c"Wrong number of arguments!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %32
8: ; preds = %2
%9 = tail call i32 @time(i32* null)
%10 = tail call i32 @srand(i32 %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = icmp sgt i32 %13, 0
br i1 %17, label %18, label %32
18: ; preds = %8
%19 = getelementptr inbounds i8*, i8** %1, i64 3
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = sub i32 1, %16
%23 = add i32 %22, %21
br label %24
24: ; preds = %18, %24
%25 = phi i32 [ 0, %18 ], [ %30, %24 ]
%26 = tail call i32 (...) @rand()
%27 = srem i32 %26, %23
%28 = add nsw i32 %27, %16
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = add nuw nsw i32 %25, 1
%31 = icmp eq i32 %30, %13
br i1 %31, label %32, label %24
32: ; preds = %24, %8, %4
%33 = phi i32 [ 1, %4 ], [ 0, %8 ], [ 0, %24 ]
ret i32 %33
}