#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ self;
typedef int /*<<< orphan*/ client_addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int LOG_ERR;
int LOG_INFO;
int /*<<< orphan*/ LOG_UPTO(int);
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ asprintf(char **, char *, char *, char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *getpid();
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
scalar_t__ listen(int, int);
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ setlogmask(int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
char *strdup(char *);
char *strtok(char *, char *);
int /*<<< orphan*/ syslog(int, char *, ...);
int /*<<< orphan*/ system(char *);
int main(int argc, char const *argv[]) {
  int sockfd;
  struct sockaddr_in self;
  char buffer[1024];
  setlogmask(LOG_UPTO(LOG_INFO | LOG_ERR));
  syslog(LOG_INFO, "Starting Email Service... pid:[%d]", getpid());
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    syslog(LOG_ERR, "[Email Service]: Error in create Socket...");
    exit(errno);
  }
  bzero(&self, sizeof(self));
  self.sin_family = AF_INET;
  self.sin_port = htons(5050);
  self.sin_addr.s_addr = INADDR_ANY;
  if (bind(sockfd, (struct sockaddr *)&self, sizeof(self)) != 0) {
    syslog(LOG_ERR, "[Email Service]: Error in Socket-bind...");
    exit(errno);
  }
  if (listen(sockfd, 20) != 0) {
    syslog(LOG_ERR, "[Email Service]: Error in Socket-listen...");
    exit(errno);
  }
  syslog(LOG_INFO, "[Email Service]: Started...");
  while (1) {
    printf("Waiting connection ... \n");
    int clientfd;
    struct sockaddr_in client_addr;
    int addrlen = sizeof(client_addr);
    clientfd = accept(sockfd, (struct sockaddr *)&client_addr, &addrlen);
    syslog(LOG_INFO, "[Email Service]: Socket %s:%d connected\n",
           inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
    recv(clientfd, buffer, 1024, 0);
    syslog(LOG_INFO, "[Email Service]: Data receive [%s]\n", buffer);
    printf("message recibe: %s by %s \n", buffer,
           inet_ntoa(client_addr.sin_addr));
    char *dup = strdup(buffer);
    char *token = strtok(dup, "|");
    int c = 0;
    char *data[2];
    while (token != NULL) {
      data[c] = token;
      c++;
      token = strtok(NULL, "|");
    }
    printf("Send data: %s to email %s\n", data[0], data[1]);
    char *command = "";
    asprintf(&command, "echo \"%s\" | mail -s \"detalles compra\" %s", data[0],
             data[1]);
    system(command);
    syslog(LOG_INFO, "[Email Service]: Email [%s] Message\n", data[1]);
    close(clientfd);
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
mov    0x2d47(%rip),%rax
or     (%rax),%edi
call   1050 <LOG_UPTO@plt>
mov    %eax,%edi
call   10b0 <setlogmask@plt>
mov    0x2d42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x46c(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x46c(%rbp),%edi
mov    %rax,%rdx
lea    0xd63(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    12ee <main+0xae>
mov    0x2ce0(%rip),%rax
mov    (%rax),%edi
lea    0xd4a(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
lea    -0x20(%rbp),%rdi
mov    $0xc,%esi
call   1120 <bzero@plt>
mov    0x2ce5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    $0x13ba,%edi
call   1080 <htons@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2cc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   1100 <bind@plt>
cmp    $0x0,%rax
je     1361 <main+0x121>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
lea    0xd02(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x14,%esi
call   10d0 <listen@plt>
cmp    $0x0,%rax
je     139d <main+0x15d>
mov    0x2c31(%rip),%rax
mov    (%rax),%edi
lea    0xcef(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
mov    0x2c32(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xcf5(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
lea    0xd03(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0xc,-0x434(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
lea    -0x434(%rbp),%rdx
call   1130 <accept@plt>
mov    %eax,-0x424(%rbp)
mov    0x2bd1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x484(%rbp)
mov    -0x430(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,-0x480(%rbp)
mov    -0x42c(%rbp),%edi
call   10f0 <ntohs@plt>
mov    -0x484(%rbp),%edi
mov    -0x480(%rbp),%rdx
mov    %eax,%ecx
lea    0xcad(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
mov    -0x424(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    0x2b6f(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rdx
lea    0xc9f(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
lea    -0x420(%rbp),%rax
mov    %rax,-0x478(%rbp)
mov    -0x430(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    -0x478(%rbp),%rsi
mov    %rax,%rdx
lea    0xc92(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0x420(%rbp),%rdi
call   1150 <strdup@plt>
mov    %rax,-0x440(%rbp)
mov    -0x440(%rbp),%rdi
lea    0xc85(%rip),%rsi
call   1110 <strtok@plt>
mov    %rax,-0x448(%rbp)
movl   $0x0,-0x44c(%rbp)
cmpq   $0x0,-0x448(%rbp)
je     151f <main+0x2df>
mov    -0x448(%rbp),%rcx
movslq -0x44c(%rbp),%rax
mov    %rcx,-0x460(%rbp,%rax,8)
ff
mov    -0x44c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xc31(%rip),%rsi
call   1110 <strtok@plt>
mov    %rax,-0x448(%rbp)
jmp    14d0 <main+0x290>
mov    -0x460(%rbp),%rsi
mov    -0x458(%rbp),%rdx
lea    0xc0d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xb94(%rip),%rax
mov    %rax,-0x468(%rbp)
mov    -0x460(%rbp),%rdx
mov    -0x458(%rbp),%rcx
lea    -0x468(%rbp),%rdi
lea    0xbf7(%rip),%rsi
call   10e0 <asprintf@plt>
mov    -0x468(%rbp),%rdi
call   1070 <system@plt>
mov    0x2a43(%rip),%rax
mov    (%rax),%edi
mov    -0x458(%rbp),%rdx
lea    0xbf8(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
mov    -0x424(%rbp),%edi
call   10a0 <close@plt>
jmp    13b4 <main+0x174>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x448,%rsp
mov    0x2d58(%rip),%r15
mov    0x2d41(%rip),%r14
mov    (%r14),%edi
or     (%r15),%edi
call   1060 <LOG_UPTO@plt>
mov    %eax,%edi
call   10c0 <setlogmask@plt>
mov    (%r15),%ebx
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xd6e(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10d0 <syslog@plt>
mov    0x2d43(%rip),%r12
mov    (%r12),%edi
mov    0x2d20(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
test   %eax,%eax
js     1485 <main+0x235>
mov    %eax,%ebx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xc,%esi
call   1130 <bzero@plt>
mov    (%r12),%eax
mov    %eax,0x28(%rsp)
mov    $0x13ba,%edi
call   1090 <htons@plt>
mov    %eax,0x24(%rsp)
mov    0x2cee(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1110 <bind@plt>
test   %rax,%rax
jne    1491 <main+0x241>
mov    %ebx,%edi
mov    $0x14,%esi
call   10e0 <listen@plt>
test   %rax,%rax
jne    149d <main+0x24d>
mov    (%r15),%edi
lea    0xd73(%rip),%rsi
xor    %eax,%eax
call   10d0 <syslog@plt>
lea    0xde9(%rip),%r12
mov    %ebx,(%rsp)
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
movl   $0xc,0x4(%rsp)
mov    %ebx,%edi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1140 <accept@plt>
mov    %eax,%r14d
mov    %r15,%rbx
mov    (%r15),%r15d
mov    0x10(%rsp),%edi
call   1070 <inet_ntoa@plt>
mov    %rax,%r13
mov    0x14(%rsp),%edi
call   1100 <ntohs@plt>
mov    %r15d,%edi
mov    %rbx,%r15
lea    0xd2e(%rip),%rsi
mov    %r13,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   10d0 <syslog@plt>
mov    %r14d,%edi
lea    0x40(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    (%r15),%edi
lea    0xd2a(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <syslog@plt>
mov    0x10(%rsp),%edi
call   1070 <inet_ntoa@plt>
lea    0xd34(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %rbx,%rdi
call   1160 <strdup@plt>
mov    %rax,%rdi
mov    %r12,%rsi
call   1120 <strtok@plt>
lea    0x30(%rsp),%rbx
nopl   0x0(%rax)
mov    %rax,(%rbx)
xor    %edi,%edi
mov    %r12,%rsi
call   1120 <strtok@plt>
add    $0x8,%rbx
test   %rax,%rax
jne    1400 <main+0x1b0>
mov    0x30(%rsp),%rbx
mov    0x38(%rsp),%rbp
lea    0xd01(%rip),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10a0 <printf@plt>
lea    0xcea(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
lea    0xcf7(%rip),%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   10f0 <asprintf@plt>
mov    0x8(%rsp),%rdi
call   1080 <system@plt>
mov    (%r15),%edi
lea    0xd01(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10d0 <syslog@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
mov    (%rsp),%ebx
jmp    1340 <main+0xf0>
mov    (%r14),%edi
lea    0xb94(%rip),%rsi
jmp    14a7 <main+0x257>
mov    (%r14),%edi
lea    0xbb3(%rip),%rsi
jmp    14a7 <main+0x257>
mov    (%r14),%edi
lea    0xbd0(%rip),%rsi
xor    %eax,%eax
call   10d0 <syslog@plt>
mov    0x2b13(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@LOG_INFO = global i32 0
@LOG_ERR = global i32 0
@.str = [35 x i8] c"Starting Email Service... pid:[%d]\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [43 x i8] c"[Email Service]: Error in create Socket...\00"
@errno = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [41 x i8] c"[Email Service]: Error in Socket-bind...\00"
@.str.3 = [43 x i8] c"[Email Service]: Error in Socket-listen...\00"
@.str.4 = [28 x i8] c"[Email Service]: Started...\00"
@.str.5 = [25 x i8] c"Waiting connection ... \0A\00"
@.str.6 = [41 x i8] c"[Email Service]: Socket %s:%d connected\0A\00"
@.str.7 = [36 x i8] c"[Email Service]: Data receive [%s]\0A\00"
@.str.8 = [27 x i8] c"message recibe: %s by %s \0A\00"
@.str.9 = [2 x i8] c"|\00"
@.str.10 = [27 x i8] c"Send data: %s to email %s\0A\00"
@.str.11 = [1 x i8] zeroinitializer
@.str.12 = [41 x i8] c"echo \22%s\22 | mail -s \22detalles compra\22 %s\00"
@.str.13 = [37 x i8] c"[Email Service]: Email [%s] Message\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca [1024 x i8]
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca [2 x i8*]
%16 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* @LOG_INFO
%18 = load i32, i32* @LOG_ERR
%19 = or i32 %17, %18
%20 = call i32 @LOG_UPTO(i32 %19)
%21 = call i32 @setlogmask(i32 %20)
%22 = load i32, i32* @LOG_INFO
%23 = call i8* (...) @getpid()
%24 = call i32 (i32, i8*, ...) @syslog(i32 %22, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @AF_INET
%26 = load i32, i32* @SOCK_STREAM
%27 = call i32 @socket(i32 %25, i32 %26, i32 0)
store i32 %27, i32* %6
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %2
%30 = load i32, i32* @LOG_ERR
%31 = call i32 (i32, i8*, ...) @syslog(i32 %30, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%32 = load i32, i32* @errno
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %2
%35 = call i32 @bzero(%struct.sockaddr_in* %7, i32 12)
%36 = load i32, i32* @AF_INET
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %36, i32* %37
%38 = call i32 @htons(i32 5050)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i32 %38, i32* %39
%40 = load i32, i32* @INADDR_ANY
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%42 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %41, i32 0, i32 0
store i32 %40, i32* %42
%43 = load i32, i32* %6
%44 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%45 = call i64 @bind(i32 %43, %struct.sockaddr* %44, i32 12)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %52
47: ; preds = %34
%48 = load i32, i32* @LOG_ERR
%49 = call i32 (i32, i8*, ...) @syslog(i32 %48, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32, i32* @errno
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %34
%53 = load i32, i32* %6
%54 = call i64 @listen(i32 %53, i32 20)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %61
56: ; preds = %52
%57 = load i32, i32* @LOG_ERR
%58 = call i32 (i32, i8*, ...) @syslog(i32 %57, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%59 = load i32, i32* @errno
%60 = call i32 @exit(i32 %59)
unreachable
61: ; preds = %52
%62 = load i32, i32* @LOG_INFO
%63 = call i32 (i32, i8*, ...) @syslog(i32 %62, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %64
64: ; preds = %61, %105
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
store i32 12, i32* %11
%66 = load i32, i32* %6
%67 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%68 = call i32 @accept(i32 %66, %struct.sockaddr* %67, i32* %11)
store i32 %68, i32* %9
%69 = load i32, i32* @LOG_INFO
%70 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%71 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %70, i32 0, i32 0
%72 = load i32, i32* %71
%73 = call i8* @inet_ntoa(i32 %72)
%74 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%75 = load i32, i32* %74
%76 = call i32 @ntohs(i32 %75)
%77 = call i32 (i32, i8*, ...) @syslog(i32 %69, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* %73, i32 %76)
%78 = load i32, i32* %9
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%80 = call i32 @recv(i32 %78, i8* %79, i32 1024, i32 0)
%81 = load i32, i32* @LOG_INFO
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%83 = call i32 (i32, i8*, ...) @syslog(i32 %81, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i8* %82)
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%85 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%86 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %85, i32 0, i32 0
%87 = load i32, i32* %86
%88 = call i8* @inet_ntoa(i32 %87)
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* %84, i8* %88)
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%91 = call i8* @strdup(i8* %90)
store i8* %91, i8** %12
%92 = load i8*, i8** %12
%93 = call i8* @strtok(i8* %92, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i8* %93, i8** %13
store i32 0, i32* %14
br label %94
94: ; preds = %97, %64
%95 = load i8*, i8** %13
%96 = icmp ne i8* %95, null
br i1 %96, label %97, label %105
97: ; preds = %94
%98 = load i8*, i8** %13
%99 = load i32, i32* %14
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 %100
store i8* %98, i8** %101
%102 = load i32, i32* %14
%103 = add nsw i32 %102, 1
store i32 %103, i32* %14
%104 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i8* %104, i8** %13
br label %94
105: ; preds = %94
%106 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 0
%107 = load i8*, i8** %106
%108 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 1
%109 = load i8*, i8** %108
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* %107, i8* %109)
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.11, i64 0, i64 0), i8** %16
%111 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 0
%112 = load i8*, i8** %111
%113 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 1
%114 = load i8*, i8** %113
%115 = call i32 @asprintf(i8** %16, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.12, i64 0, i64 0), i8* %112, i8* %114)
%116 = load i8*, i8** %16
%117 = call i32 @system(i8* %116)
%118 = load i32, i32* @LOG_INFO
%119 = getelementptr inbounds [2 x i8*], [2 x i8*]* %15, i64 0, i64 1
%120 = load i8*, i8** %119
%121 = call i32 (i32, i8*, ...) @syslog(i32 %118, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i8* %120)
%122 = load i32, i32* %9
%123 = call i32 @close(i32 %122)
br label %64
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@LOG_INFO = global i32 0
@LOG_ERR = global i32 0
@.str = [35 x i8] c"Starting Email Service... pid:[%d]\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [43 x i8] c"[Email Service]: Error in create Socket...\00"
@errno = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [41 x i8] c"[Email Service]: Error in Socket-bind...\00"
@.str.3 = [43 x i8] c"[Email Service]: Error in Socket-listen...\00"
@.str.4 = [28 x i8] c"[Email Service]: Started...\00"
@.str.6 = [41 x i8] c"[Email Service]: Socket %s:%d connected\0A\00"
@.str.7 = [36 x i8] c"[Email Service]: Data receive [%s]\0A\00"
@.str.8 = [27 x i8] c"message recibe: %s by %s \0A\00"
@.str.9 = [2 x i8] c"|\00"
@.str.10 = [27 x i8] c"Send data: %s to email %s\0A\00"
@.str.11 = [1 x i8] zeroinitializer
@.str.12 = [41 x i8] c"echo \22%s\22 | mail -s \22detalles compra\22 %s\00"
@.str.13 = [37 x i8] c"[Email Service]: Email [%s] Message\0A\00"
@str = [24 x i8] c"Waiting connection ... \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1024 x i8]
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca [2 x i8*]
%8 = alloca i8*
%9 = bitcast %struct.sockaddr_in* %3 to i8*
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = load i32, i32* @LOG_INFO
%12 = load i32, i32* @LOG_ERR
%13 = or i32 %12, %11
%14 = tail call i32 @LOG_UPTO(i32 %13)
%15 = tail call i32 @setlogmask(i32 %14)
%16 = load i32, i32* @LOG_INFO
%17 = tail call i8* (...) @getpid()
%18 = tail call i32 (i32, i8*, ...) @syslog(i32 %16, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @AF_INET
%20 = load i32, i32* @SOCK_STREAM
%21 = tail call i32 @socket(i32 %19, i32 %20, i32 0)
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %2
%24 = load i32, i32* @LOG_ERR
%25 = tail call i32 (i32, i8*, ...) @syslog(i32 %24, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @errno
%27 = tail call i32 @exit(i32 %26)
unreachable
28: ; preds = %2
%29 = call i32 @bzero(%struct.sockaddr_in* %3, i32 12)
%30 = load i32, i32* @AF_INET
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %30, i32* %31
%32 = tail call i32 @htons(i32 5050)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %32, i32* %33
%34 = load i32, i32* @INADDR_ANY
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %34, i32* %35
%36 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%37 = call i64 @bind(i32 %21, %struct.sockaddr* %36, i32 12)
%38 = icmp eq i64 %37, 0
br i1 %38, label %44, label %39
39: ; preds = %28
%40 = load i32, i32* @LOG_ERR
%41 = call i32 (i32, i8*, ...) @syslog(i32 %40, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%42 = load i32, i32* @errno
%43 = call i32 @exit(i32 %42)
unreachable
44: ; preds = %28
%45 = call i64 @listen(i32 %21, i32 20)
%46 = icmp eq i64 %45, 0
br i1 %46, label %52, label %47
47: ; preds = %44
%48 = load i32, i32* @LOG_ERR
%49 = call i32 (i32, i8*, ...) @syslog(i32 %48, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%50 = load i32, i32* @errno
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %44
%53 = load i32, i32* @LOG_INFO
%54 = call i32 (i32, i8*, ...) @syslog(i32 %53, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%55 = bitcast %struct.sockaddr_in* %5 to i8*
%56 = bitcast i32* %6 to i8*
%57 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0, i32 0
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1
%60 = bitcast [2 x i8*]* %7 to i8*
%61 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%62 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 1
%63 = bitcast i8** %8 to i8*
br label %64
64: ; preds = %89, %52
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
store i32 12, i32* %6
%66 = call i32 @accept(i32 %21, %struct.sockaddr* %57, i32* %6)
%67 = load i32, i32* @LOG_INFO
%68 = load i32, i32* %58
%69 = call i8* @inet_ntoa(i32 %68)
%70 = load i32, i32* %59
%71 = call i32 @ntohs(i32 %70)
%72 = call i32 (i32, i8*, ...) @syslog(i32 %67, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* %69, i32 %71)
%73 = call i32 @recv(i32 %66, i8* %10, i32 1024, i32 0)
%74 = load i32, i32* @LOG_INFO
%75 = call i32 (i32, i8*, ...) @syslog(i32 %74, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i8* %10)
%76 = load i32, i32* %58
%77 = call i8* @inet_ntoa(i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* %10, i8* %77)
%79 = call i8* @strdup(i8* %10)
%80 = call i8* @strtok(i8* %79, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%81 = icmp ne i8* %80, null
br label %82
82: ; preds = %64, %82
%83 = phi i64 [ %86, %82 ], [ 0, %64 ]
%84 = phi i8* [ %87, %82 ], [ %80, %64 ]
%85 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 %83
store i8* %84, i8** %85
%86 = add nuw i64 %83, 1
%87 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%88 = icmp eq i8* %87, null
br i1 %88, label %89, label %82
89: ; preds = %82
%90 = load i8*, i8** %61
%91 = load i8*, i8** %62
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* %90, i8* %91)
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.11, i64 0, i64 0), i8** %8
%93 = call i32 @asprintf(i8** %8, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.12, i64 0, i64 0), i8* %90, i8* %91)
%94 = load i8*, i8** %8
%95 = call i32 @system(i8* %94)
%96 = load i32, i32* @LOG_INFO
%97 = call i32 (i32, i8*, ...) @syslog(i32 %96, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i8* %91)
%98 = call i32 @close(i32 %66)
br label %64
}