#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 grand(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int i, j, number_jobs, min_lim, max_lim, n;
  if (argc != 4) {
    printf("Command pattern: command \"NUMBER_OF_JOBS\" \"MIN_LIMIT\" "
           "\"MAX_LIMIT\"\n");
    return 0;
  }
  srand((unsigned)time(NULL));
  number_jobs = atoi(argv[1]);
  min_lim = atoi(argv[2]);
  max_lim = atoi(argv[3]) + 1;
  for (i = 0; i < number_jobs; i++) {
    for (j = 0; j < 2; j++) {
      n = grand(min_lim, max_lim);
      printf("%d ", n);
    }
    n = grand(min_lim, max_lim);
    printf("%d\n", n);
  }
  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)
cmpl   $0x4,-0x8(%rbp)
je     118a <main+0x3a>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1252 <main+0x102>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    124b <main+0xfb>
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jge    121e <main+0xce>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1030 <grand@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e7 <main+0x97>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1030 <grand@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d4 <main+0x84>
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
cmp    $0x4,%edi
jne    1209 <main+0xa9>
mov    %rsi,%rbp
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    0x8(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbp),%rdi
call   1080 <atoi@plt>
test   %ebx,%ebx
jle    1215 <main+0xb5>
mov    %eax,%ebp
add    $0x1,%ebp
lea    0xe4e(%rip),%r15
lea    0xe4b(%rip),%r12
nopl   0x0(%rax)
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <grand@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <grand@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <grand@plt>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebx
jne    11c0 <main+0x60>
jmp    1215 <main+0xb5>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [67 x i8] c"Command pattern: command \22NUMBER_OF_JOBS\22 \22MIN_LIMIT\22 \22MAX_LIMIT\22\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%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
%13 = icmp ne i32 %12, 4
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %60
16: ; preds = %2
%17 = call i64 @time(i32* null)
%18 = trunc i64 %17 to i32
%19 = call i32 @srand(i32 %18)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %8
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %9
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 3
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
%32 = add nsw i32 %31, 1
store i32 %32, i32* %10
store i32 0, i32* %6
br label %33
33: ; preds = %56, %16
%34 = load i32, i32* %6
%35 = load i32, i32* %8
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %59
37: ; preds = %33
store i32 0, i32* %7
br label %38
38: ; preds = %47, %37
%39 = load i32, i32* %7
%40 = icmp slt i32 %39, 2
br i1 %40, label %41, label %50
41: ; preds = %38
%42 = load i32, i32* %9
%43 = load i32, i32* %10
%44 = call i32 @grand(i32 %42, i32 %43)
store i32 %44, i32* %11
%45 = load i32, i32* %11
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %41
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %38
50: ; preds = %38
%51 = load i32, i32* %9
%52 = load i32, i32* %10
%53 = call i32 @grand(i32 %51, i32 %52)
store i32 %53, i32* %11
%54 = load i32, i32* %11
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %50
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %33
59: ; preds = %33
store i32 0, i32* %3
br label %60
60: ; preds = %59, %14
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [66 x i8] c"Command pattern: command \22NUMBER_OF_JOBS\22 \22MIN_LIMIT\22 \22MAX_LIMIT\22\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
br label %31
6: ; preds = %2
%7 = tail call i64 @time(i32* null)
%8 = trunc i64 %7 to i32
%9 = tail call i32 @srand(i32 %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = add nsw i32 %18, 1
%20 = icmp sgt i32 %12, 0
br i1 %20, label %21, label %31
21: ; preds = %6, %21
%22 = phi i32 [ %29, %21 ], [ 0, %6 ]
%23 = tail call i32 @grand(i32 %15, i32 %19)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = tail call i32 @grand(i32 %15, i32 %19)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = tail call i32 @grand(i32 %15, i32 %19)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i32 %22, 1
%30 = icmp eq i32 %29, %12
br i1 %30, label %31, label %21
31: ; preds = %21, %6, %4
ret i32 0
}