#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  srand(time(0));
  int nums[10], max = 0;
  printf("Serie original: \n\t");
  for (int i = 0; i < 10; i++) {
    nums[i] = (rand() % 100) + 1;
    if (nums[i] > max)
      max = nums[i];
    printf("%d%s", nums[i], (i == 9) ? "\n" : ", ");
  }
  printf("\nImprimiendo numeros que son menores a %d:\n", max);
  for (int i = 0; i < 10; i++)
    if (nums[i] < max)
      printf("\t%d\n", nums[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x34(%rbp)
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11f5 <main+0xb5>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
movslq -0x38(%rbp),%rax
mov    %edx,-0x30(%rbp,%rax,4)
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x34(%rbp),%eax
jle    11b9 <main+0x79>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
mov    -0x38(%rbp),%ecx
lea    0xe4d(%rip),%rdx
lea    0xe73(%rip),%rax
cmp    $0x9,%ecx
cmove  %rax,%rdx
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1179 <main+0x39>
mov    -0x34(%rbp),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    1251 <main+0x111>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x34(%rbp),%eax
jge    123e <main+0xfe>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1243 <main+0x103>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    120d <main+0xcd>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xfffffffffffffff6,%rbx
lea    0xecf(%rip),%r15
lea    0xe9b(%rip),%r12
lea    0xe8f(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
mov    %eax,%edx
sub    %ecx,%edx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
cmp    %ebp,%edx
cmovge %esi,%ebp
mov    %esi,0x28(%rsp,%rbx,4)
inc    %rbx
mov    %r12,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %rbx,%rbx
jne    1190 <main+0x50>
lea    0xe36(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
cmp    %ebp,%esi
jge    1203 <main+0xc3>
lea    0xe4b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
cmp    %ebp,%esi
jge    1219 <main+0xd9>
lea    0xe35(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
cmp    %ebp,%esi
jge    122f <main+0xef>
lea    0xe1f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
cmp    %ebp,%esi
jge    1245 <main+0x105>
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
cmp    %ebp,%esi
jge    125b <main+0x11b>
lea    0xdf3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
cmp    %ebp,%esi
jge    1271 <main+0x131>
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
cmp    %ebp,%esi
jge    1287 <main+0x147>
lea    0xdc7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
cmp    %ebp,%esi
jge    129d <main+0x15d>
lea    0xdb1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
cmp    %ebp,%esi
jge    12b3 <main+0x173>
lea    0xd9b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
cmp    %ebp,%esi
jge    12c9 <main+0x189>
lea    0xd85(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Serie original: \0A\09\00"
@.str.1 = [5 x i8] c"%d%s\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [44 x i8] c"\0AImprimiendo numeros que son menores a %d:\0A\00"
@.str.5 = [5 x i8] c"\09%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @time(i32 0)
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %9
9: ; preds = %40, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %43
12: ; preds = %9
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 100
%15 = add nsw i32 %14, 1
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %17
store i32 %15, i32* %18
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = load i32, i32* %3
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %30
25: ; preds = %12
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
store i32 %29, i32* %3
br label %30
30: ; preds = %25, %12
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 9
%37 = zext i1 %36 to i64
%38 = select i1 %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %34, i8* %38)
br label %40
40: ; preds = %30
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %9
43: ; preds = %9
%44 = load i32, i32* %3
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %44)
store i32 0, i32* %5
br label %46
46: ; preds = %63, %43
%47 = load i32, i32* %5
%48 = icmp slt i32 %47, 10
br i1 %48, label %49, label %66
49: ; preds = %46
%50 = load i32, i32* %5
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = load i32, i32* %3
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %62
56: ; preds = %49
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %56, %49
br label %63
63: ; preds = %62
%64 = load i32, i32* %5
%65 = add nsw i32 %64, 1
store i32 %65, i32* %5
br label %46
66: ; preds = %46
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Serie original: \0A\09\00"
@.str.1 = [5 x i8] c"%d%s\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [44 x i8] c"\0AImprimiendo numeros que son menores a %d:\0A\00"
@.str.5 = [5 x i8] c"\09%d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = tail call i32 @time(i32 0)
%3 = tail call i32 @srand(i32 %2)
%4 = bitcast [10 x i32]* %1 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %11
6: ; preds = %11
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%9 = load i32, i32* %8
%10 = icmp slt i32 %9, %19
br i1 %10, label %25, label %27
11: ; preds = %0, %11
%12 = phi i64 [ 0, %0 ], [ %23, %11 ]
%13 = phi i32 [ 0, %0 ], [ %19, %11 ]
%14 = tail call i32 (...) @rand()
%15 = srem i32 %14, 100
%16 = add nsw i32 %15, 1
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %12
store i32 %16, i32* %17
%18 = icmp slt i32 %15, %13
%19 = select i1 %18, i32 %13, i32 %16
%20 = icmp eq i64 %12, 9
%21 = select i1 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %21)
%23 = add nuw nsw i64 %12, 1
%24 = icmp eq i64 %23, 10
br i1 %24, label %6, label %11
25: ; preds = %6
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %9)
br label %27
27: ; preds = %6, %25
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%29 = load i32, i32* %28
%30 = icmp slt i32 %29, %19
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %29)
br label %33
33: ; preds = %31, %27
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%35 = load i32, i32* %34
%36 = icmp slt i32 %35, %19
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %35)
br label %39
39: ; preds = %37, %33
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%41 = load i32, i32* %40
%42 = icmp slt i32 %41, %19
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %41)
br label %45
45: ; preds = %43, %39
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%47 = load i32, i32* %46
%48 = icmp slt i32 %47, %19
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %47)
br label %51
51: ; preds = %49, %45
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%53 = load i32, i32* %52
%54 = icmp slt i32 %53, %19
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %53)
br label %57
57: ; preds = %55, %51
%58 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%59 = load i32, i32* %58
%60 = icmp slt i32 %59, %19
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %59)
br label %63
63: ; preds = %61, %57
%64 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%65 = load i32, i32* %64
%66 = icmp slt i32 %65, %19
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %65)
br label %69
69: ; preds = %67, %63
%70 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%71 = load i32, i32* %70
%72 = icmp slt i32 %71, %19
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %71)
br label %75
75: ; preds = %73, %69
%76 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%77 = load i32, i32* %76
%78 = icmp slt i32 %77, %19
br i1 %78, label %79, label %81
79: ; preds = %75
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %77)
br label %81
81: ; preds = %79, %75
ret i32 0
}