#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 */
struct nodo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ imprime(struct nodo **);
int /*<<< orphan*/ insereOrdem(struct nodo **, int);
int /*<<< orphan*/ printf(char *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i;
  struct nodo *lse = NULL;
  srand(time(NULL));
  for (i = 0; i < 20; i++) {
    int rnd = rand() % 100;
    insereOrdem(&lse, rnd);
  }
  printf("LSE inserida de forma ordenada:\n");
  imprime(&lse);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    11c4 <main+0x64>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    -0x10(%rbp),%rdi
call   1040 <insereOrdem@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118e <main+0x2e>
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1050 <imprime@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movq   $0x0,(%rsp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    $0x14,%ebp
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rsi
imul   $0x51eb851f,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%esi
mov    %rbx,%rdi
call   1040 <insereOrdem@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x30>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1050 <imprime@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.nodo = type { i32 }
@.str = [33 x i8] c"LSE inserida de forma ordenada:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.nodo*
%4 = alloca i32
store i32 0, i32* %1
store %struct.nodo* null, %struct.nodo** %3
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
store i32 0, i32* %2
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 20
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 100
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = call i32 @insereOrdem(%struct.nodo** %3, i32 %13)
br label %15
15: ; preds = %10
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %7
18: ; preds = %7
%19 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @imprime(%struct.nodo** %3)
ret i32 0
}

LLVM IR (-O2):
%struct.nodo = type { i32 }
@str = [32 x i8] c"LSE inserida de forma ordenada:\00"
define i32 @main() {
%1 = alloca %struct.nodo*
%2 = bitcast %struct.nodo** %1 to i8*
store %struct.nodo* null, %struct.nodo** %1
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %10, %5 ]
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 100
%9 = call i32 @insereOrdem(%struct.nodo** %1, i32 %8)
%10 = add nuw nsw i32 %6, 1
%11 = icmp eq i32 %10, 20
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%14 = call i32 @imprime(%struct.nodo** %1)
ret i32 0
}