#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 /*<<< orphan*/ scanf(char *, int *);
void insere_lista(int vetor[], int tam_vetor) {
  int i, tmp;
  for (i = 0; i < tam_vetor; i++) {
    printf("valor da posicao %d: ", i);
    scanf("%d", &tmp);
    while (tmp >= 256) {
      printf("valor invalido!");
      scanf("%d", &tmp);
    }
    vetor[i] = tmp;
  }
}


x86 assembly (clang, -O0):
<insere_lista>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11af <insere_lista+0x8f>
mov    -0x10(%rbp),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x100,-0x14(%rbp)
jl     1193 <insere_lista+0x73>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1163 <insere_lista+0x43>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <insere_lista+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insere_lista>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11b2 <insere_lista+0x92>
mov    %rdi,%r15
mov    %esi,%r14d
lea    0xed6(%rip),%r12
lea    0x4(%rsp),%rbx
lea    0xecd(%rip),%r13
xor    %ebp,%ebp
jmp    115d <insere_lista+0x3d>
mov    %eax,(%r15,%rbp,4)
add    $0x1,%rbp
cmp    %r14,%rbp
je     11b2 <insere_lista+0x92>
lea    0xe9c(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x100,%eax
jl     1150 <insere_lista+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xff,%eax
jg     1190 <insere_lista+0x70>
jmp    1150 <insere_lista+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"valor da posicao %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"valor invalido!\00"
define void @insere_lista(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %27, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = load i32, i32* %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %15
15: ; preds = %18, %11
%16 = load i32, i32* %6
%17 = icmp sge i32 %16, 256
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %15
21: ; preds = %15
%22 = load i32, i32* %6
%23 = load i32*, i32** %3
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
br label %27
27: ; preds = %21
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %7
30: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"valor da posicao %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"valor invalido!\00"
define void @insere_lista(i32* nocapture writeonly %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %25
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %20
%9 = phi i64 [ 0, %6 ], [ %23, %20 ]
%10 = trunc i64 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 255
br i1 %14, label %15, label %20
15: ; preds = %8, %15
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 255
br i1 %19, label %15, label %20
20: ; preds = %15, %8
%21 = phi i32 [ %13, %8 ], [ %18, %15 ]
%22 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %21, i32* %22
%23 = add nuw nsw i64 %9, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %25, label %8
25: ; preds = %20, %2
ret void
}