#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 inserir(int vet[10], int *ini, int *num) {
  if (*num == 10) {
    printf("\n\a\tA fila esta cheia!\n");
    return;
  }
  int val;
  printf("\n\tDigite um valor -> ");
  scanf("%d", &val);
  vet[(*ini + *num >= 10) ? (*ini + (*num)++ - 10) : (*ini + (*num)++)] = val;
  return;
}


x86 assembly (clang, -O0):
<inserir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0xa,(%rax)
jne    1152 <inserir+0x32>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
jmp    11d9 <inserir+0xb9>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
add    (%rcx),%eax
cmp    $0xa,%eax
jl     11b1 <inserir+0x91>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rdx
mov    (%rdx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,(%rdx)
add    %ecx,%eax
sub    $0xa,%eax
mov    %eax,-0x30(%rbp)
jmp    11c9 <inserir+0xa9>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rdx
mov    (%rdx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,(%rdx)
add    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inserir>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmpl   $0xa,(%rdx)
jne    1153 <inserir+0x23>
lea    0xed4(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    (%r15),%ecx
mov    (%rbx),%edx
lea    (%rdx,%rcx,1),%esi
lea    0x1(%rdx),%edi
cmp    $0xa,%esi
mov    %edi,(%rbx)
lea    -0xa(%rdx,%rcx,1),%ecx
cmovl  %esi,%ecx
movslq %ecx,%rcx
mov    %eax,(%r14,%rcx,4)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\07\09A fila esta cheia!\0A\00"
@.str.1 = [22 x i8] c"\0A\09Digite um valor -> \00"
@.str.2 = [3 x i8] c"%d\00"
define void @inserir(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %43
13: ; preds = %3
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%16 = load i32, i32* %7
%17 = load i32*, i32** %4
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = load i32*, i32** %6
%21 = load i32, i32* %20
%22 = add nsw i32 %19, %21
%23 = icmp sge i32 %22, 10
br i1 %23, label %24, label %32
24: ; preds = %13
%25 = load i32*, i32** %5
%26 = load i32, i32* %25
%27 = load i32*, i32** %6
%28 = load i32, i32* %27
%29 = add nsw i32 %28, 1
store i32 %29, i32* %27
%30 = add nsw i32 %26, %28
%31 = sub nsw i32 %30, 10
br label %39
32: ; preds = %13
%33 = load i32*, i32** %5
%34 = load i32, i32* %33
%35 = load i32*, i32** %6
%36 = load i32, i32* %35
%37 = add nsw i32 %36, 1
store i32 %37, i32* %35
%38 = add nsw i32 %34, %36
br label %39
39: ; preds = %32, %24
%40 = phi i32 [ %31, %24 ], [ %38, %32 ]
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %17, i64 %41
store i32 %16, i32* %42
br label %43
43: ; preds = %39, %11
ret void
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"\0A\09Digite um valor -> \00"
@.str.2 = [3 x i8] c"%d\00"
@str = [22 x i8] c"\0A\07\09A fila esta cheia!\00"
define void @inserir(i32* nocapture writeonly %0, i32* nocapture %1, i32* nocapture %2) {
%4 = alloca i32
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 10
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %23
9: ; preds = %3
%10 = bitcast i32* %4 to i8*
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%13 = load i32, i32* %4
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = add nsw i32 %15, %14
%17 = icmp sgt i32 %16, 9
%18 = add nsw i32 %15, 1
store i32 %18, i32* %2
%19 = add nsw i32 %16, -10
%20 = select i1 %17, i32 %19, i32 %16
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %0, i64 %21
store i32 %13, i32* %22
br label %23
23: ; preds = %9, %7
ret void
}