#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 clienteTCP(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ funcionAES(int);
int /*<<< orphan*/ funcionRSA(int);
int /*<<< orphan*/ funcionSHA(int);
int menuAlgortimos(int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int s;
  int retorno;
  if (argc < 2) {
    printf("El software debe ser llamado como cliente IPdelServidor: cliente "
           "192.168.1.55");
    return 2;
  }
  s = clienteTCP(argv[1]);
  printf("\x1B[32m           +---------------------------------------+\n");
  printf("           |    ~·~ ClIENTE  CRIPTOGRAFICO   ~·    |\n");
  printf("           +---------------------------------------+\x1B[0m\n");
  retorno = menuAlgortimos(s);
  if (retorno == -1) {
    close(s);
    return 0;
  }
  switch (retorno) {
  case 1:
    funcionAES(s);
    break;
  case 2:
    funcionRSA(s);
    break;
  case 3:
    funcionSHA(s);
    break;
  }
  close(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a8 <main+0x38>
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    126c <main+0xfc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <clienteTCP@plt>
mov    %eax,-0x14(%rbp)
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xeea(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1050 <menuAlgortimos@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1205 <main+0x95>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    126c <main+0xfc>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     123b <main+0xcb>
jmp    1219 <main+0xa9>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     1248 <main+0xd8>
jmp    122a <main+0xba>
mov    -0x1c(%rbp),%eax
sub    $0x3,%eax
je     1255 <main+0xe5>
jmp    125d <main+0xed>
mov    -0x14(%rbp),%edi
call   1080 <funcionAES@plt>
jmp    125d <main+0xed>
mov    -0x14(%rbp),%edi
call   1070 <funcionRSA@plt>
jmp    125d <main+0xed>
mov    -0x14(%rbp),%edi
call   1030 <funcionSHA@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jg     1199 <main+0x19>
lea    0xe87(%rip),%rdi
call   1050 <printf@plt>
mov    $0x2,%eax
pop    %rbx
ret
mov    0x8(%rsi),%rdi
call   10a0 <clienteTCP@plt>
mov    %eax,%ebx
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1060 <menuAlgortimos@plt>
add    $0x1,%eax
cmp    $0x4,%eax
ja     1200 <main+0x80>
lea    0xe22(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %ebx,%edi
call   1090 <funcionAES@plt>
jmp    1200 <main+0x80>
mov    %ebx,%edi
call   1080 <funcionRSA@plt>
jmp    1200 <main+0x80>
mov    %ebx,%edi
call   1040 <funcionSHA@plt>
mov    %ebx,%edi
call   1070 <close@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [78 x i8] c"El software debe ser llamado como cliente IPdelServidor: cliente 192.168.1.55\00"
@.str.1 = [59 x i8] c"\1B[32m +---------------------------------------+\0A\00"
@.str.2 = [56 x i8] c" | ~\C2\B7~ ClIENTE CRIPTOGRAFICO ~\C2\B7 |\0A\00"
@.str.3 = [58 x i8] c" +---------------------------------------+\1B[0m\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %3
br label %41
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @clienteTCP(i8* %15)
store i32 %16, i32* %6
%17 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* %6
%21 = call i32 @menuAlgortimos(i32 %20)
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %27
24: ; preds = %12
%25 = load i32, i32* %6
%26 = call i32 @close(i32 %25)
store i32 0, i32* %3
br label %41
27: ; preds = %12
%28 = load i32, i32* %7
switch i32 %28, label %38 [
i32 1, label %29
i32 2, label %32
i32 3, label %35
]
29: ; preds = %27
%30 = load i32, i32* %6
%31 = call i32 @funcionAES(i32 %30)
br label %38
32: ; preds = %27
%33 = load i32, i32* %6
%34 = call i32 @funcionRSA(i32 %33)
br label %38
35: ; preds = %27
%36 = load i32, i32* %6
%37 = call i32 @funcionSHA(i32 %36)
br label %38
38: ; preds = %27, %35, %32, %29
%39 = load i32, i32* %6
%40 = call i32 @close(i32 %39)
store i32 0, i32* %3
br label %41
41: ; preds = %38, %24, %10
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [78 x i8] c"El software debe ser llamado como cliente IPdelServidor: cliente 192.168.1.55\00"
@str = [58 x i8] c"\1B[32m +---------------------------------------+\00"
@str.4 = [55 x i8] c" | ~\C2\B7~ ClIENTE CRIPTOGRAFICO ~\C2\B7 |\00"
@str.5 = [57 x i8] c" +---------------------------------------+\1B[0m\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
br label %24
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @clienteTCP(i8* %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.4, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.5, i64 0, i64 0))
%13 = tail call i32 @menuAlgortimos(i32 %9)
switch i32 %13, label %22 [
i32 -1, label %14
i32 1, label %16
i32 2, label %18
i32 3, label %20
]
14: ; preds = %6
%15 = tail call i32 @close(i32 %9)
br label %24
16: ; preds = %6
%17 = tail call i32 @funcionAES(i32 %9)
br label %22
18: ; preds = %6
%19 = tail call i32 @funcionRSA(i32 %9)
br label %22
20: ; preds = %6
%21 = tail call i32 @funcionSHA(i32 %9)
br label %22
22: ; preds = %6, %20, %18, %16
%23 = tail call i32 @close(i32 %9)
br label %24
24: ; preds = %22, %14, %4
%25 = phi i32 [ 2, %4 ], [ 0, %14 ], [ 0, %22 ]
ret i32 %25
}