#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 /*<<< orphan*/ errno;
int /*<<< orphan*/ internal_logit(char *, int, char *, char *,
                                  int /*<<< orphan*/);
int send(int, int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int send_int(int sock, int i) {
  int res;
  res = send(sock, &i, sizeof(int), 0);
  if (res == -1)
    internal_logit("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/ecthiender/mocp-git/refs/"
                   "heads/master/protocol.c",
                   103, "UNKNOWN_FUNC", "send() failed: %s", strerror(errno));
  return res == sizeof(int) ? 1 : 0;
}


x86 assembly (clang, -O0):
<send_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    118e <send_int+0x5e>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    %eax,%r8d
lea    0xe8a(%rip),%rdi
mov    $0x67,%esi
lea    0xf09(%rip),%rdx
lea    0xf0f(%rip),%rcx
call   1050 <internal_logit@plt>
movslq -0xc(%rbp),%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x4,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_int>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1181 <send_int+0x51>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xe9a(%rip),%rdi
lea    0xf1e(%rip),%rdx
lea    0xf24(%rip),%rcx
mov    $0x67,%esi
mov    %eax,%r8d
call   1050 <internal_logit@plt>
xor    %eax,%eax
cmp    $0x4,%ebx
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ecthiender/mocp-git/refs/heads/master/protocol.c\00"
@.str.1 = [13 x i8] c"UNKNOWN_FUNC\00"
@.str.2 = [18 x i8] c"send() failed: %s\00"
@errno = global i32 0
define i32 @send_int(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @send(i32 %6, i32* %4, i32 4, i32 0)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* @errno
%12 = call i32 @strerror(i32 %11)
%13 = call i32 @internal_logit(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 103, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %10, %2
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = icmp eq i64 %16, 4
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 1, i32 0
ret i32 %19
}

LLVM IR (-O2):
@.str = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ecthiender/mocp-git/refs/heads/master/protocol.c\00"
@.str.1 = [13 x i8] c"UNKNOWN_FUNC\00"
@.str.2 = [18 x i8] c"send() failed: %s\00"
@errno = global i32 0
define i32 @send_int(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @send(i32 %0, i32* %3, i32 4, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @errno
%8 = call i32 @strerror(i32 %7)
%9 = call i32 @internal_logit(i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str, i64 0, i64 0), i32 103, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %6, %2
%11 = icmp eq i32 %4, 4
%12 = zext i1 %11 to i32
ret i32 %12
}