#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 excluiMultiploTres(struct nodo **);
int excluiNodo(struct nodo **, int);
int /*<<< orphan*/ imprime(struct nodo **);
int /*<<< orphan*/ insereDireita(struct nodo **, int);
int /*<<< orphan*/ insereParImpar(struct nodo **, struct nodo **,
                                  struct nodo **);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i;
  struct nodo *lseOriginal = NULL;
  struct nodo *lsePar = NULL;
  struct nodo *lseImpar = NULL;
  srand(time(NULL));
  for (i = 0; i < 20; i++) {
    int rnd = rand() % 101;
    insereDireita(&lseOriginal, rnd);
  }
  printf("LSE original:\n");
  imprime(&lseOriginal);
  insereParImpar(&lseOriginal, &lsePar, &lseImpar);
  printf("LSE par:\n");
  imprime(&lsePar);
  printf("LSE impar:\n");
  imprime(&lseImpar);
  int num;
  printf("Digite o número para tentar excluir da lse par: ");
  scanf("%i", &num);
  int ret = excluiNodo(&lsePar, num);
  if (ret == 0) {
    printf("Nenhum nodo na lse par foi encontrado para exclusão\n");
  }
  printf("LSE par:\n");
  imprime(&lsePar);
  int nExcluidos = excluiMultiploTres(&lseImpar);
  printf("%i numeros múltiplos de 3 foram excluídos da lse impar.\n",
         nExcluidos);
  printf("LSE impar:\n");
  imprime(&lseImpar);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1214 <main+0x74>
mov    $0x0,%al
call   10c0 <rand@plt>
mov    $0x65,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    -0x10(%rbp),%rdi
call   1070 <insereDireita@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11de <main+0x3e>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1050 <imprime@plt>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1090 <insereParImpar@plt>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1050 <imprime@plt>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <imprime@plt>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd8(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x28(%rbp),%esi
lea    -0x18(%rbp),%rdi
call   10b0 <excluiNodo@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    12af <main+0x10f>
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1050 <imprime@plt>
lea    -0x20(%rbp),%rdi
call   1030 <excluiMultiploTres@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <imprime@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    $0x14,%ebp
lea    0x20(%rsp),%rbx
nopl   (%rax)
xor    %eax,%eax
call   10d0 <rand@plt>
movslq %eax,%rsi
imul   $0x288df0cb,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rax
add    %ecx,%eax
imul   $0x65,%eax,%eax
sub    %eax,%esi
mov    %rbx,%rdi
call   1080 <insereDireita@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0x40>
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <imprime@plt>
lea    0x18(%rsp),%r14
lea    0x10(%rsp),%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10a0 <insereParImpar@plt>
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1060 <imprime@plt>
lea    0xe1b(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1060 <imprime@plt>
lea    0xd80(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xda4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   10b0 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
call   10c0 <excluiNodo@plt>
test   %eax,%eax
jne    12b4 <main+0x104>
lea    0xde3(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc3(%rip),%rdi
call   1030 <puts@plt>
lea    0x18(%rsp),%rdi
call   1060 <imprime@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <excluiMultiploTres@plt>
lea    0xd57(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd99(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1060 <imprime@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.nodo = type { i32 }
@.str = [15 x i8] c"LSE original:\0A\00"
@.str.1 = [10 x i8] c"LSE par:\0A\00"
@.str.2 = [12 x i8] c"LSE impar:\0A\00"
@.str.3 = [50 x i8] c"Digite o n\C3\BAmero para tentar excluir da lse par: \00"
@.str.4 = [3 x i8] c"%i\00"
@.str.5 = [54 x i8] c"Nenhum nodo na lse par foi encontrado para exclus\C3\A3o\0A\00"
@.str.6 = [59 x i8] c"%i numeros m\C3\BAltiplos de 3 foram exclu\C3\ADdos da lse impar.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.nodo*
%4 = alloca %struct.nodo*
%5 = alloca %struct.nodo*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store %struct.nodo* null, %struct.nodo** %3
store %struct.nodo* null, %struct.nodo** %4
store %struct.nodo* null, %struct.nodo** %5
%10 = call i32 @time(i32* null)
%11 = call i32 @srand(i32 %10)
store i32 0, i32* %2
br label %12
12: ; preds = %20, %0
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 20
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 101
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = call i32 @insereDireita(%struct.nodo** %3, i32 %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %12
23: ; preds = %12
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @imprime(%struct.nodo** %3)
%26 = call i32 @insereParImpar(%struct.nodo** %3, %struct.nodo** %4, %struct.nodo** %5)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 @imprime(%struct.nodo** %4)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @imprime(%struct.nodo** %5)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%33 = load i32, i32* %7
%34 = call i32 @excluiNodo(%struct.nodo** %4, i32 %33)
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %23
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
br label %39
39: ; preds = %37, %23
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%41 = call i32 @imprime(%struct.nodo** %4)
%42 = call i32 @excluiMultiploTres(%struct.nodo** %5)
store i32 %42, i32* %9
%43 = load i32, i32* %9
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i32 %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%46 = call i32 @imprime(%struct.nodo** %5)
ret i32 0
}

LLVM IR (-O2):
%struct.nodo = type { i32 }
@.str.3 = [50 x i8] c"Digite o n\C3\BAmero para tentar excluir da lse par: \00"
@.str.4 = [3 x i8] c"%i\00"
@.str.6 = [59 x i8] c"%i numeros m\C3\BAltiplos de 3 foram exclu\C3\ADdos da lse impar.\0A\00"
@str = [14 x i8] c"LSE original:\00"
@str.9 = [9 x i8] c"LSE par:\00"
@str.10 = [11 x i8] c"LSE impar:\00"
@str.11 = [53 x i8] c"Nenhum nodo na lse par foi encontrado para exclus\C3\A3o\00"
define i32 @main() {
%1 = alloca %struct.nodo*
%2 = alloca %struct.nodo*
%3 = alloca %struct.nodo*
%4 = alloca i32
%5 = bitcast %struct.nodo** %1 to i8*
store %struct.nodo* null, %struct.nodo** %1
%6 = bitcast %struct.nodo** %2 to i8*
store %struct.nodo* null, %struct.nodo** %2
%7 = bitcast %struct.nodo** %3 to i8*
store %struct.nodo* null, %struct.nodo** %3
%8 = tail call i32 @time(i32* null)
%9 = tail call i32 @srand(i32 %8)
br label %10
10: ; preds = %0, %10
%11 = phi i32 [ 0, %0 ], [ %15, %10 ]
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 101
%14 = call i32 @insereDireita(%struct.nodo** %1, i32 %13)
%15 = add nuw nsw i32 %11, 1
%16 = icmp eq i32 %15, 20
br i1 %16, label %17, label %10
17: ; preds = %10
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%19 = call i32 @imprime(%struct.nodo** %1)
%20 = call i32 @insereParImpar(%struct.nodo** %1, %struct.nodo** %2, %struct.nodo** %3)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
%22 = call i32 @imprime(%struct.nodo** %2)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.10, i64 0, i64 0))
%24 = call i32 @imprime(%struct.nodo** %3)
%25 = bitcast i32* %4 to i8*
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%28 = load i32, i32* %4
%29 = call i32 @excluiNodo(%struct.nodo** %2, i32 %28)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %17
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.11, i64 0, i64 0))
br label %33
33: ; preds = %31, %17
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
%35 = call i32 @imprime(%struct.nodo** %2)
%36 = call i32 @excluiMultiploTres(%struct.nodo** %3)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i32 %36)
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.10, i64 0, i64 0))
%39 = call i32 @imprime(%struct.nodo** %3)
ret i32 0
}