#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int socket(int, int, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int Socket(int domain, int type, int protocol) {
  int sockfd;
  if ((sockfd = socket(domain, type, protocol)) == -1) {
    do {
      fprintf(stderr,
              "[SYSLOG] [%s][%d]"
              "ERROR: socket failed!\n"
              "%s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Windeal/Demo/refs/heads/master/"
              "Chatting/C/common/socketapi.c",
              28, (0 <= 0 ? "" : strerror(0)));
    } while (0);
    ;
    exit(errno);
  }
  return sockfd;
}


x86 assembly (clang, -O0):
<Socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <socket@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
jne    1196 <Socket+0x66>
jmp    1160 <Socket+0x30>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
lea    0xeb4(%rip),%rdx
mov    $0x1c,%ecx
lea    0xea7(%rip),%r8
call   1030 <fprintf@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Socket>:
push   %rax
call   1050 <socket@plt>
cmp    $0xffffffff,%eax
je     113d <Socket+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
lea    0xed7(%rip),%rdx
lea    0xecf(%rip),%r8
mov    $0x1c,%ecx
call   1030 <fprintf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"[SYSLOG] [%s][%d]ERROR: socket failed!\0A%s\0A\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Windeal/Demo/refs/heads/master/Chatting/C/common/socketapi.c\00"
@.str.2 = [1 x i8] zeroinitializer
@errno = global i32 0
define i32 @Socket(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @socket(i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %20
13: ; preds = %3
br label %14
14: ; preds = %13
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %14
%18 = load i32, i32* @errno
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %3
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"[SYSLOG] [%s][%d]ERROR: socket failed!\0A%s\0A\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Windeal/Demo/refs/heads/master/Chatting/C/common/socketapi.c\00"
@.str.2 = [1 x i8] zeroinitializer
@errno = global i32 0
define i32 @Socket(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* @errno
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %3
ret i32 %4
}