#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 sortear_numeros(int *, int, int, int, int);
int main() {
  int i, qtd;
  int nums[15];
  qtd = sortear_numeros(nums, 1, 60, 6, 15);
  printf("qtd = %d\n", qtd);
  for (i = 0; i < qtd; i++)
    printf("\tnums[%d] = %d\n", i, nums[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x1,%esi
mov    $0x3c,%edx
mov    $0x6,%ecx
mov    $0xf,%r8d
call   1040 <sortear_numeros@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119b <main+0x7b>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1168 <main+0x48>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x3c,%edx
mov    $0x6,%ecx
mov    $0xf,%r8d
call   1040 <sortear_numeros@plt>
mov    %eax,%ebx
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
jle    1188 <main+0x68>
mov    %ebx,%r15d
lea    0xea4(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"qtd = %d\0A\00"
@.str.1 = [16 x i8] c"\09nums[%d] = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [15 x i32]
store i32 0, i32* %1
%5 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 0
%6 = call i32 @sortear_numeros(i32* %5, i32 1, i32 60, i32 6, i32 15)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
store i32 0, i32* %2
br label %9
9: ; preds = %20, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %9
23: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"qtd = %d\0A\00"
@.str.1 = [16 x i8] c"\09nums[%d] = %d\0A\00"
define i32 @main() {
%1 = alloca [15 x i32]
%2 = bitcast [15 x i32]* %1 to i8*
%3 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 0
%4 = call i32 @sortear_numeros(i32* %3, i32 1, i32 60, i32 6, i32 15)
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %17
7: ; preds = %0
%8 = zext i32 %4 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %15, %9 ]
%11 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = trunc i64 %10 to i32
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %12)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %0
ret i32 0
}