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

/* Variables and functions */
int /*<<< orphan*/ deletaPilha(struct pilha **, int);
int /*<<< orphan*/ empilha(struct pilha **, int);
int /*<<< orphan*/ imprimeLDE(struct nodod **);
int /*<<< orphan*/ imprimeLSE(struct nodo **);
int /*<<< orphan*/ imprimePilha(struct pilha **);
int /*<<< orphan*/ insereImparPilhaEsquerdaLSE(struct pilha **, struct nodo **);
int /*<<< orphan*/ insereParPilhaDireitaLDE(struct pilha **, struct nodod **,
                                            struct nodod **);
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 pilha *topo = NULL;
  struct nodo *LSE = NULL;
  struct nodod *LDEInicio = NULL;
  struct nodod *LDEFim = NULL;
  srand(time(NULL));
  for (i = 0; i < 25; i++) {
    int rnd = rand() % 100;
    empilha(&topo, rnd);
  }
  printf("Valores da pilha:\n\t");
  imprimePilha(&topo);
  insereImparPilhaEsquerdaLSE(&topo, &LSE);
  printf("Valores da LSE:\n\t");
  imprimeLSE(&LSE);
  insereParPilhaDireitaLDE(&topo, &LDEInicio, &LDEFim);
  printf("Valores da LDE:\n\t");
  imprimeLDE(&LDEInicio);
  int valDel;
  printf("Digite um valor a ser deletado da pilha: ");
  scanf("%i", &valDel);
  deletaPilha(&topo, valDel);
  printf("\n\nValores finais das listas:\n");
  printf("Valores da pilha:\n\t");
  imprimePilha(&topo);
  printf("Valores da LSE:\n\t");
  imprimeLSE(&LSE);
  printf("Valores da LDE:\n\t");
  imprimeLDE(&LDEInicio);
}


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)
movq   $0x0,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x19,-0x8(%rbp)
jge    123c <main+0x7c>
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    -0x10(%rbp),%rdi
call   1030 <empilha@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1206 <main+0x46>
lea    0xdbd(%rip),%rdi
call   1060 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1040 <imprimePilha@plt>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10a0 <insereImparPilhaEsquerdaLSE@plt>
lea    0xdaf(%rip),%rdi
call   1060 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1050 <imprimeLSE@plt>
lea    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1070 <insereParPilhaDireitaLDE@plt>
lea    0xd9b(%rip),%rdi
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
call   10e0 <imprimeLDE@plt>
lea    0xd98(%rip),%rdi
call   1060 <printf@plt>
lea    0xdb6(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   10c0 <scanf@plt>
mov    -0x30(%rbp),%esi
lea    -0x10(%rbp),%rdi
call   10b0 <deletaPilha@plt>
lea    0xd9d(%rip),%rdi
call   1060 <printf@plt>
lea    0xd2c(%rip),%rdi
call   1060 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1040 <imprimePilha@plt>
lea    0xd2b(%rip),%rdi
call   1060 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1050 <imprimeLSE@plt>
lea    0xd28(%rip),%rdi
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
call   10e0 <imprimeLDE@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1090 <srand@plt>
mov    $0x19,%ebp
lea    0x8(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10e0 <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   1030 <empilha@plt>
add    $0xffffffff,%ebp
jne    1220 <main+0x50>
lea    0xda9(%rip),%r14
mov    %r14,%rdi
call   1070 <printf@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <imprimePilha@plt>
lea    0x20(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <insereImparPilhaEsquerdaLSE@plt>
lea    0xd91(%rip),%r13
mov    %r13,%rdi
call   1070 <printf@plt>
mov    %r15,%rdi
call   1060 <imprimeLSE@plt>
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <insereParPilhaDireitaLDE@plt>
lea    0xd77(%rip),%rbp
mov    %rbp,%rdi
call   1070 <printf@plt>
mov    %r12,%rdi
call   10f0 <imprimeLDE@plt>
lea    0xd72(%rip),%rdi
call   1070 <printf@plt>
lea    0xd90(%rip),%rdi
lea    0x4(%rsp),%rsi
call   10d0 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   10c0 <deletaPilha@plt>
lea    0xd76(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <imprimePilha@plt>
mov    %r13,%rdi
call   1070 <printf@plt>
mov    %r15,%rdi
call   1060 <imprimeLSE@plt>
mov    %rbp,%rdi
call   1070 <printf@plt>
mov    %r12,%rdi
call   10f0 <imprimeLDE@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.pilha = type { i32 }
%struct.nodo = type { i32 }
%struct.nodod = type { i32 }
@.str = [20 x i8] c"Valores da pilha:\0A\09\00"
@.str.1 = [18 x i8] c"Valores da LSE:\0A\09\00"
@.str.2 = [18 x i8] c"Valores da LDE:\0A\09\00"
@.str.3 = [42 x i8] c"Digite um valor a ser deletado da pilha: \00"
@.str.4 = [3 x i8] c"%i\00"
@.str.5 = [30 x i8] c"\0A\0AValores finais das listas:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.pilha*
%4 = alloca %struct.nodo*
%5 = alloca %struct.nodod*
%6 = alloca %struct.nodod*
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store %struct.pilha* null, %struct.pilha** %3
store %struct.nodo* null, %struct.nodo** %4
store %struct.nodod* null, %struct.nodod** %5
store %struct.nodod* null, %struct.nodod** %6
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
store i32 0, i32* %2
br label %11
11: ; preds = %19, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 25
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 100
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = call i32 @empilha(%struct.pilha** %3, i32 %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %11
22: ; preds = %11
%23 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @imprimePilha(%struct.pilha** %3)
%25 = call i32 @insereImparPilhaEsquerdaLSE(%struct.pilha** %3, %struct.nodo** %4)
%26 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @imprimeLSE(%struct.nodo** %4)
%28 = call i32 @insereParPilhaDireitaLDE(%struct.pilha** %3, %struct.nodod** %5, %struct.nodod** %6)
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%30 = call i32 @imprimeLDE(%struct.nodod** %5)
%31 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 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* %8)
%33 = load i32, i32* %8
%34 = call i32 @deletaPilha(%struct.pilha** %3, i32 %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%37 = call i32 @imprimePilha(%struct.pilha** %3)
%38 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @imprimeLSE(%struct.nodo** %4)
%40 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 @imprimeLDE(%struct.nodod** %5)
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
%struct.pilha = type { i32 }
%struct.nodo = type { i32 }
%struct.nodod = type { i32 }
@.str = [20 x i8] c"Valores da pilha:\0A\09\00"
@.str.1 = [18 x i8] c"Valores da LSE:\0A\09\00"
@.str.2 = [18 x i8] c"Valores da LDE:\0A\09\00"
@.str.3 = [42 x i8] c"Digite um valor a ser deletado da pilha: \00"
@.str.4 = [3 x i8] c"%i\00"
@str = [29 x i8] c"\0A\0AValores finais das listas:\00"
define i32 @main() {
%1 = alloca %struct.pilha*
%2 = alloca %struct.nodo*
%3 = alloca %struct.nodod*
%4 = alloca %struct.nodod*
%5 = alloca i32
%6 = bitcast %struct.pilha** %1 to i8*
store %struct.pilha* null, %struct.pilha** %1
%7 = bitcast %struct.nodo** %2 to i8*
store %struct.nodo* null, %struct.nodo** %2
%8 = bitcast %struct.nodod** %3 to i8*
store %struct.nodod* null, %struct.nodod** %3
%9 = bitcast %struct.nodod** %4 to i8*
store %struct.nodod* null, %struct.nodod** %4
%10 = tail call i32 @time(i32* null)
%11 = tail call i32 @srand(i32 %10)
br label %12
12: ; preds = %0, %12
%13 = phi i32 [ 0, %0 ], [ %17, %12 ]
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 100
%16 = call i32 @empilha(%struct.pilha** %1, i32 %15)
%17 = add nuw nsw i32 %13, 1
%18 = icmp eq i32 %17, 25
br i1 %18, label %19, label %12
19: ; preds = %12
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @imprimePilha(%struct.pilha** %1)
%22 = call i32 @insereImparPilhaEsquerdaLSE(%struct.pilha** %1, %struct.nodo** %2)
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @imprimeLSE(%struct.nodo** %2)
%25 = call i32 @insereParPilhaDireitaLDE(%struct.pilha** %1, %struct.nodod** %3, %struct.nodod** %4)
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @imprimeLDE(%struct.nodod** %3)
%28 = bitcast i32* %5 to i8*
%29 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%31 = load i32, i32* %5
%32 = call i32 @deletaPilha(%struct.pilha** %1, i32 %31)
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%34 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%35 = call i32 @imprimePilha(%struct.pilha** %1)
%36 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @imprimeLSE(%struct.nodo** %2)
%38 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 @imprimeLDE(%struct.nodod** %3)
ret i32 0
}