#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 {
  char *sin_zero;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
void correo(int valor) {
  int clientSocket;
  char buffer[1024];
  struct sockaddr_in serverAddr;
  socklen_t addr_size;
  clientSocket = socket(PF_INET, SOCK_STREAM, 0);
  serverAddr.sin_family = AF_INET;
  serverAddr.sin_port = htons(8891);
  serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
  memset(serverAddr.sin_zero, '\0', sizeof serverAddr.sin_zero);
  addr_size = sizeof serverAddr;
  connect(clientSocket, (struct sockaddr *)&serverAddr, addr_size);
  if (valor == 1)
    strcpy(buffer, "Transaccion exitosa");
  else
    strcpy(buffer, "Saldo insuficiente");
  send(clientSocket, buffer, strlen(buffer), 0);
  memset(buffer, '\0', 1024);
  recv(clientSocket, buffer, 1024, 0);
}


x86 assembly (clang, -O0):
<correo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    0x2e2a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <socket@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x418(%rbp)
mov    $0x22bb,%edi
call   1060 <htons@plt>
mov    %eax,-0x41c(%rbp)
lea    0xe20(%rip),%rdi
call   1090 <inet_addr@plt>
mov    %eax,-0x420(%rbp)
mov    -0x428(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1080 <memset@plt>
movl   $0x18,-0x42c(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x428(%rbp),%rsi
mov    -0x42c(%rbp),%edx
call   10a0 <connect@plt>
cmpl   $0x1,-0x4(%rbp)
jne    123f <correo+0xaf>
lea    -0x410(%rbp),%rdi
lea    0xdd5(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1252 <correo+0xc2>
lea    -0x410(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x43c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x438(%rbp)
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x43c(%rbp),%edi
mov    -0x438(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    -0x8(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<correo>:
push   %rbp
push   %rbx
sub    $0x428,%rsp
mov    %edi,%ebp
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
mov    0x2e2d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <socket@plt>
mov    %eax,%ebx
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    $0x22bb,%edi
call   1060 <htons@plt>
mov    %eax,0x14(%rsp)
lea    0xe28(%rip),%rdi
call   1090 <inet_addr@plt>
mov    %eax,0x10(%rsp)
xor    %esi,%esi
mov    $0x8,%edx
call   1080 <memset@plt>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0x18,%edx
call   10a0 <connect@plt>
cmp    $0x1,%ebp
lea    0xe02(%rip),%rax
lea    0xe0f(%rip),%rsi
cmove  %rax,%rsi
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
add    $0x428,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [20 x i8] c"Transaccion exitosa\00"
@.str.2 = [19 x i8] c"Saldo insuficiente\00"
define void @correo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* @PF_INET
%8 = load i32, i32* @SOCK_STREAM
%9 = call i32 @socket(i32 %7, i32 %8, i32 0)
store i32 %9, i32* %3
%10 = load i32, i32* @AF_INET
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 3
store i32 %10, i32* %11
%12 = call i32 @htons(i32 8891)
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 2
store i32 %12, i32* %13
%14 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 1
%16 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %15, i32 0, i32 0
store i32 %14, i32* %16
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 0
%18 = load i8*, i8** %17
%19 = call i32 @memset(i8* %18, i8 signext 0, i32 8)
store i32 24, i32* %6
%20 = load i32, i32* %3
%21 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%22 = load i32, i32* %6
%23 = call i32 @connect(i32 %20, %struct.sockaddr* %21, i32 %22)
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %1
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%28 = call i32 @strcpy(i8* %27, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %32
29: ; preds = %1
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%31 = call i32 @strcpy(i8* %30, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %29, %26
%33 = load i32, i32* %3
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%36 = call i32 @strlen(i8* %35)
%37 = call i32 @send(i32 %33, i8* %34, i32 %36, i32 0)
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%39 = call i32 @memset(i8* %38, i8 signext 0, i32 1024)
%40 = load i32, i32* %3
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%42 = call i32 @recv(i32 %40, i8* %41, i32 1024, i32 0)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [20 x i8] c"Transaccion exitosa\00"
@.str.2 = [19 x i8] c"Saldo insuficiente\00"
define void @correo(i32 %0) {
%2 = alloca [1024 x i8]
%3 = alloca %struct.sockaddr_in
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = load i32, i32* @PF_INET
%7 = load i32, i32* @SOCK_STREAM
%8 = tail call i32 @socket(i32 %6, i32 %7, i32 0)
%9 = load i32, i32* @AF_INET
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 3
store i32 %9, i32* %10
%11 = tail call i32 @htons(i32 8891)
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %11, i32* %12
%13 = tail call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %13, i32* %14
%15 = tail call i32 @memset(i8* undef, i8 signext 0, i32 8)
%16 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%17 = call i32 @connect(i32 %8, %struct.sockaddr* %16, i32 24)
%18 = icmp eq i32 %0, 1
%19 = select i1 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0)
%20 = call i32 @strcpy(i8* %4, i8* %19)
%21 = call i32 @strlen(i8* %4)
%22 = call i32 @send(i32 %8, i8* %4, i32 %21, i32 0)
%23 = call i32 @memset(i8* %4, i8 signext 0, i32 1024)
%24 = call i32 @recv(i32 %8, i8* %4, i32 1024, i32 0)
ret void
}