#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdin;
int main() {
  int tamanho_alocar = 0;
  printf("Insira o tamanho em bytes que deseja alocar na memória.\n");
  printf("Bytes: ");
  scanf("%d", &tamanho_alocar);
  while (tamanho_alocar % 4 != 0 || tamanho_alocar == 0) {
    setbuf(stdin, NULL);
    printf("Tamanho inválido, insira um valor múltiplo de 4.\n");
    printf("Alocar: ");
    scanf("%d", &tamanho_alocar);
  }
  int *nums = (int *)calloc(tamanho_alocar / 4, sizeof(int));
  if (nums == NULL) {
    printf("Erro: Sem memória.\n");
    exit(1);
  } else {
    printf("%d bytes alocados com sucesso!\n", tamanho_alocar);
  }
  if (tamanho_alocar / 4 == 1) {
    printf("%d posição diponível no array.\n", tamanho_alocar / 4);
  } else {
    printf("%d posições diponíveis no array.\n", tamanho_alocar / 4);
  }
  int opcao = 0, posicao = 0;
  while (1) {
    setbuf(stdin, NULL);
    printf("######### Menu #########:\n");
    printf("1. Preencher uma posição do array.\n");
    printf("2. Consultar um dos valores.\n");
    printf("Digite -999 para encerrar a execução do programa.\n");
    printf("Opção: ");
    scanf("%d", &opcao);
    printf("########################\n");
    if (opcao > 2 || opcao < 1) {
      if (opcao == -999)
        break;
      printf("Opção inválida!\n");
      continue;
    }
    if (opcao == 1) {
      setbuf(stdin, NULL);
      printf("Qual posição alterar: ");
      scanf("%d", &posicao);
      printf("Digite o valor que a posição %d terá: ", posicao);
      scanf("%d", &nums[posicao]);
      printf("Valor %d atribuído à posição %d com sucesso!\n", nums[posicao],
             posicao);
    }
    if (opcao == 2) {
      printf("Qual posição consultar: ");
      scanf("%d", &posicao);
      printf("nums[%d]: %d\n", posicao, nums[posicao]);
    }
    if (opcao == -999) {
      break;
    }
  }
  free(nums);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x19(%rbp)
jne    11c5 <main+0x65>
cmpl   $0x0,-0x8(%rbp)
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11d5 <main+0x75>
jmp    1218 <main+0xb8>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe38(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
jmp    11a2 <main+0x42>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1256 <main+0xf6>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x1,%eax
jne    129b <main+0x13b>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12b6 <main+0x156>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2d1d(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd1f(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x2,-0x14(%rbp)
jg     134e <main+0x1ee>
cmpl   $0x1,-0x14(%rbp)
jge    1373 <main+0x213>
cmpl   $0xfffffc19,-0x14(%rbp)
jne    1360 <main+0x200>
jmp    1450 <main+0x2f0>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12c4 <main+0x164>
cmpl   $0x1,-0x14(%rbp)
jne    13f5 <main+0x295>
mov    0x2c64(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc9e(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x18(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xc6e(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x18(%rbp),%edx
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x2,-0x14(%rbp)
jne    1439 <main+0x2d9>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc2e(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0xfffffc19,-0x14(%rbp)
jne    144b <main+0x2eb>
jmp    1450 <main+0x2f0>
jmp    12c4 <main+0x164>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
lea    0xf97(%rip),%rdi
call   1040 <puts@plt>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe61(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x10(%rsp),%eax
test   %eax,%eax
je     11c0 <main+0x50>
mov    %eax,%ecx
and    $0x3,%ecx
je     1229 <main+0xb9>
mov    0x2e21(%rip),%r12
lea    0x105f(%rip),%r14
lea    0xe36(%rip),%r15
lea    0xe2c(%rip),%rbx
lea    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    0x10(%rsp),%eax
mov    %eax,%ecx
and    $0x3,%ecx
test   %eax,%eax
je     11f0 <main+0x80>
test   %ecx,%ecx
jne    11f0 <main+0x80>
lea    0x3(%rax),%edi
test   %eax,%eax
cmovns %eax,%edi
sar    $0x2,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
test   %rax,%rax
je     1423 <main+0x2b3>
mov    %rax,%rbx
mov    0x10(%rsp),%esi
lea    0xdbf(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%eax
mov    %eax,%ecx
and    $0xfffffffc,%ecx
cmp    $0x4,%ecx
jne    1278 <main+0x108>
lea    0xdc3(%rip),%rdi
mov    $0x1,%esi
jmp    128a <main+0x11a>
lea    0x3(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x2,%esi
lea    0xdcd(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movl   $0x0,0x14(%rsp)
movl   $0x0,0xc(%rsp)
mov    0x2d40(%rip),%r13
lea    0xdcd(%rip),%rbp
lea    0xd52(%rip),%r14
lea    0x14(%rsp),%r15
lea    0xf2b(%rip),%r12
jmp    1310 <main+0x1a0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
movslq 0xc(%rsp),%rsi
mov    (%rbx,%rsi,4),%edx
lea    0xe1c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%rsp),%eax
cmp    $0xfffffc19,%eax
je     140a <main+0x29a>
mov    0x0(%r13),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
lea    0xe3b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe49(%rip),%rdi
call   1040 <puts@plt>
lea    0xe62(%rip),%rdi
call   1040 <puts@plt>
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    0x14(%rsp),%eax
lea    -0x3(%rax),%ecx
cmp    $0xfffffffd,%ecx
ja     1390 <main+0x220>
cmp    $0xfffffc19,%eax
je     140a <main+0x29a>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
jmp    1310 <main+0x1a0>
nopl   (%rax)
cmp    $0x1,%eax
jne    12d0 <main+0x160>
mov    0x0(%r13),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
lea    0xcdb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xcd5(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movslq 0xc(%rsp),%rax
lea    (%rbx,%rax,4),%rsi
mov    %r14,%rdi
call   1080 <scanf@plt>
movslq 0xc(%rsp),%rdx
mov    (%rbx,%rdx,4),%esi
lea    0xcd8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%rsp),%eax
cmp    $0x2,%eax
je     12d0 <main+0x160>
jmp    1305 <main+0x195>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdef(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [58 x i8] c"Insira o tamanho em bytes que deseja alocar na mem\C3\B3ria.\0A\00"
@.str.1 = [8 x i8] c"Bytes: \00"
@.str.2 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.3 = [52 x i8] c"Tamanho inv\C3\A1lido, insira um valor m\C3\BAltiplo de 4.\0A\00"
@.str.4 = [9 x i8] c"Alocar: \00"
@.str.5 = [21 x i8] c"Erro: Sem mem\C3\B3ria.\0A\00"
@.str.6 = [32 x i8] c"%d bytes alocados com sucesso!\0A\00"
@.str.7 = [35 x i8] c"%d posi\C3\A7\C3\A3o dipon\C3\ADvel no array.\0A\00"
@.str.8 = [37 x i8] c"%d posi\C3\A7\C3\B5es dipon\C3\ADveis no array.\0A\00"
@.str.9 = [27 x i8] c"######### Menu #########:\0A\00"
@.str.10 = [38 x i8] c"1. Preencher uma posi\C3\A7\C3\A3o do array.\0A\00"
@.str.11 = [30 x i8] c"2. Consultar um dos valores.\0A\00"
@.str.12 = [53 x i8] c"Digite -999 para encerrar a execu\C3\A7\C3\A3o do programa.\0A\00"
@.str.13 = [10 x i8] c"Op\C3\A7\C3\A3o: \00"
@.str.14 = [26 x i8] c"########################\0A\00"
@.str.15 = [20 x i8] c"Op\C3\A7\C3\A3o inv\C3\A1lida!\0A\00"
@.str.16 = [25 x i8] c"Qual posi\C3\A7\C3\A3o alterar: \00"
@.str.17 = [42 x i8] c"Digite o valor que a posi\C3\A7\C3\A3o %d ter\C3\A1: \00"
@.str.18 = [50 x i8] c"Valor %d atribu\C3\ADdo \C3\A0 posi\C3\A7\C3\A3o %d com sucesso!\0A\00"
@.str.19 = [27 x i8] c"Qual posi\C3\A7\C3\A3o consultar: \00"
@.str.20 = [14 x i8] c"nums[%d]: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %2
%11 = srem i32 %10, 4
%12 = icmp ne i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %9
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br label %16
16: ; preds = %13, %9
%17 = phi i1 [ true, %9 ], [ %15, %13 ]
br i1 %17, label %18, label %24
18: ; preds = %16
%19 = load i32, i32* @stdin
%20 = call i32 @setbuf(i32 %19, i32* null)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %9
24: ; preds = %16
%25 = load i32, i32* %2
%26 = sdiv i32 %25, 4
%27 = call i64 @calloc(i32 %26, i32 4)
%28 = inttoptr i64 %27 to i32*
store i32* %28, i32** %3
%29 = load i32*, i32** %3
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %24
%35 = load i32, i32* %2
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34
%38 = load i32, i32* %2
%39 = sdiv i32 %38, 4
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i32, i32* %2
%43 = sdiv i32 %42, 4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %43)
br label %49
45: ; preds = %37
%46 = load i32, i32* %2
%47 = sdiv i32 %46, 4
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %45, %41
store i32 0, i32* %4
store i32 0, i32* %5
br label %50
50: ; preds = %49, %69, %110
%51 = load i32, i32* @stdin
%52 = call i32 @setbuf(i32 %51, i32* null)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0))
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.12, i64 0, i64 0))
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0))
%60 = load i32, i32* %4
%61 = icmp sgt i32 %60, 2
br i1 %61, label %65, label %62
62: ; preds = %50
%63 = load i32, i32* %4
%64 = icmp slt i32 %63, 1
br i1 %64, label %65, label %71
65: ; preds = %62, %50
%66 = load i32, i32* %4
%67 = icmp eq i32 %66, -999
br i1 %67, label %68, label %69
68: ; preds = %65
br label %111
69: ; preds = %65
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0))
br label %50
71: ; preds = %62
%72 = load i32, i32* %4
%73 = icmp eq i32 %72, 1
br i1 %73, label %74, label %93
74: ; preds = %71
%75 = load i32, i32* @stdin
%76 = call i32 @setbuf(i32 %75, i32* null)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0))
%78 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%79 = load i32, i32* %5
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.17, i64 0, i64 0), i32 %79)
%81 = load i32*, i32** %3
%82 = load i32, i32* %5
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i32, i32* %81, i64 %83
%85 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %84)
%86 = load i32*, i32** %3
%87 = load i32, i32* %5
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i32, i32* %86, i64 %88
%90 = load i32, i32* %89
%91 = load i32, i32* %5
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.18, i64 0, i64 0), i32 %90, i32 %91)
br label %93
93: ; preds = %74, %71
%94 = load i32, i32* %4
%95 = icmp eq i32 %94, 2
br i1 %95, label %96, label %106
96: ; preds = %93
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0))
%98 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%99 = load i32, i32* %5
%100 = load i32*, i32** %3
%101 = load i32, i32* %5
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i32, i32* %100, i64 %102
%104 = load i32, i32* %103
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0), i32 %99, i32 %104)
br label %106
106: ; preds = %96, %93
%107 = load i32, i32* %4
%108 = icmp eq i32 %107, -999
br i1 %108, label %109, label %110
109: ; preds = %106
br label %111
110: ; preds = %106
br label %50
111: ; preds = %109, %68
%112 = load i32*, i32** %3
%113 = call i32 @free(i32* %112)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"Bytes: \00"
@.str.2 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.4 = [9 x i8] c"Alocar: \00"
@.str.6 = [32 x i8] c"%d bytes alocados com sucesso!\0A\00"
@.str.7 = [35 x i8] c"%d posi\C3\A7\C3\A3o dipon\C3\ADvel no array.\0A\00"
@.str.8 = [37 x i8] c"%d posi\C3\A7\C3\B5es dipon\C3\ADveis no array.\0A\00"
@.str.13 = [10 x i8] c"Op\C3\A7\C3\A3o: \00"
@.str.16 = [25 x i8] c"Qual posi\C3\A7\C3\A3o alterar: \00"
@.str.17 = [42 x i8] c"Digite o valor que a posi\C3\A7\C3\A3o %d ter\C3\A1: \00"
@.str.18 = [50 x i8] c"Valor %d atribu\C3\ADdo \C3\A0 posi\C3\A7\C3\A3o %d com sucesso!\0A\00"
@.str.19 = [27 x i8] c"Qual posi\C3\A7\C3\A3o consultar: \00"
@.str.20 = [14 x i8] c"nums[%d]: %d\0A\00"
@str = [57 x i8] c"Insira o tamanho em bytes que deseja alocar na mem\C3\B3ria.\00"
@str.21 = [26 x i8] c"######### Menu #########:\00"
@str.22 = [37 x i8] c"1. Preencher uma posi\C3\A7\C3\A3o do array.\00"
@str.23 = [29 x i8] c"2. Consultar um dos valores.\00"
@str.24 = [52 x i8] c"Digite -999 para encerrar a execu\C3\A7\C3\A3o do programa.\00"
@str.25 = [25 x i8] c"########################\00"
@str.26 = [19 x i8] c"Op\C3\A7\C3\A3o inv\C3\A1lida!\00"
@str.27 = [20 x i8] c"Erro: Sem mem\C3\B3ria.\00"
@str.28 = [51 x i8] c"Tamanho inv\C3\A1lido, insira um valor m\C3\BAltiplo de 4.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = and i32 %8, 3
%10 = icmp ne i32 %9, 0
%11 = icmp eq i32 %8, 0
%12 = or i1 %11, %10
br i1 %12, label %13, label %24
13: ; preds = %0, %13
%14 = load i32, i32* @stdin
%15 = call i32 @setbuf(i32 %14, i32* null)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.28, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = and i32 %19, 3
%21 = icmp ne i32 %20, 0
%22 = icmp eq i32 %19, 0
%23 = or i1 %22, %21
br i1 %23, label %13, label %24
24: ; preds = %13, %0
%25 = phi i32 [ %8, %0 ], [ %19, %13 ]
%26 = sdiv i32 %25, 4
%27 = call i64 @calloc(i32 %26, i32 4)
%28 = inttoptr i64 %27 to i32*
%29 = icmp eq i64 %27, 0
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.27, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %24
%34 = load i32, i32* %1
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %1
%37 = and i32 %36, -4
%38 = icmp eq i32 %37, 4
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 1)
br label %44
41: ; preds = %33
%42 = sdiv i32 %36, 4
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %41, %39
%45 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%46 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %47
47: ; preds = %64, %44
%48 = load i32, i32* @stdin
%49 = call i32 @setbuf(i32 %48, i32* null)
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.21, i64 0, i64 0))
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.22, i64 0, i64 0))
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.23, i64 0, i64 0))
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.24, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%55 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.25, i64 0, i64 0))
%57 = load i32, i32* %2
%58 = add i32 %57, -3
%59 = icmp ult i32 %58, -2
br i1 %59, label %60, label %65
60: ; preds = %47
%61 = icmp eq i32 %57, -999
br i1 %61, label %97, label %62
62: ; preds = %60
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.26, i64 0, i64 0))
br label %64
64: ; preds = %62, %94
br label %47
65: ; preds = %47
%66 = icmp eq i32 %57, 1
br i1 %66, label %67, label %85
67: ; preds = %65
%68 = load i32, i32* @stdin
%69 = call i32 @setbuf(i32 %68, i32* null)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0))
%71 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%72 = load i32, i32* %3
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.17, i64 0, i64 0), i32 %72)
%74 = load i32, i32* %3
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i32, i32* %28, i64 %75
%77 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %76)
%78 = load i32, i32* %3
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %28, i64 %79
%81 = load i32, i32* %80
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.18, i64 0, i64 0), i32 %81, i32 %78)
%83 = load i32, i32* %2
%84 = icmp eq i32 %83, 2
br i1 %84, label %85, label %94
85: ; preds = %65, %67
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0))
%87 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%88 = load i32, i32* %3
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i32, i32* %28, i64 %89
%91 = load i32, i32* %90
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.20, i64 0, i64 0), i32 %88, i32 %91)
%93 = load i32, i32* %2
br label %94
94: ; preds = %85, %67
%95 = phi i32 [ %93, %85 ], [ %83, %67 ]
%96 = icmp eq i32 %95, -999
br i1 %96, label %97, label %64
97: ; preds = %94, %60
%98 = call i32 @free(i32* %28)
ret i32 0
}