#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);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int socket(int, int, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int Socket(int family, int type, int protocal) {
  int n;
  if ((n = socket(family, type, protocal)) < 0) {
    fprintf(stderr, "%s:%d: Socket(): %s\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/Ricky-Gong/LegoCar/refs/heads/master/"
            "CarServer/self/zed_spec/wrap.c",
            15, strerror(errno));
    exit(1);
  }
  return n;
}


x86 assembly (clang, -O0):
<Socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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   1060 <socket@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jge    11ad <Socket+0x6d>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%r8
lea    0xe6e(%rip),%rsi
lea    0xe7c(%rip),%rdx
mov    $0xf,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Socket>:
push   %rbx
call   1060 <socket@plt>
test   %eax,%eax
js     114c <Socket+0xc>
pop    %rbx
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%ebx
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe96(%rip),%rsi
lea    0xea4(%rip),%rdx
mov    %ebx,%edi
mov    $0xf,%ecx
mov    %rax,%r8
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"%s:%d: Socket(): %s\0A\00"
@.str.1 = [158 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Ricky-Gong/LegoCar/refs/heads/master/CarServer/self/zed_spec/wrap.c\00"
@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 slt i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i32, i32* @errno
%16 = call i8* @strerror(i32 %15)
%17 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0), i32 15, i8* %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %3
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"%s:%d: Socket(): %s\0A\00"
@.str.1 = [158 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Ricky-Gong/LegoCar/refs/heads/master/CarServer/self/zed_spec/wrap.c\00"
@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 slt i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0), i32 15, i8* %9)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %3
ret i32 %4
}