#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 */
struct timespec {
  scalar_t__ tv_sec;
};
struct stat {
  scalar_t__ st_mtime;
};
struct sockaddr_storage {
  int dummy;
};
struct sockaddr_in6 {
  int /*<<< orphan*/ sin6_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int sa_family;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
int /*<<< orphan*/ CLOCK_REALTIME;
int EINVAL;
int ENODATA;
int ENOENT;
int ESTALE;
int clock_gettime(int /*<<< orphan*/, struct timespec *);
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t fread(int /*<<< orphan*/ *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_storage *, int /*<<< orphan*/, int);
int stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ unlink(char *);
int get_cached_ip(struct sockaddr *addr) {
  if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6)
    return EINVAL;
  struct stat sb;
  struct timespec ts;
  int rc = stat("/tmp/bind_public.ip", &sb);
  if (rc != 0) {
    int errsv = errno;
    if (errsv != ENOENT) {
      fprintf(stderr, "bind_public: stat(%s) errno = %d\n",
              "/tmp/bind_public.ip", errsv);
    }
    return errsv;
  }
  rc = clock_gettime(CLOCK_REALTIME, &ts);
  if (rc != 0) {
    int errsv = errno;
    fprintf(stderr, "bind_public: clock_gettime(CLOCK_REALTIME) errno = %d\n",
            errsv);
    return errsv;
  }
  if (ts.tv_sec > sb.st_mtime + 3600) {
    return ESTALE;
  }
  FILE *f = fopen("/tmp/bind_public.ip", "r");
  if (!f) {
    int errsv = errno;
    fprintf(stderr, "bind_public: fopen(%s) errno = %d\n",
            "/tmp/bind_public.ip", errsv);
    return errsv;
  }
  struct sockaddr_storage buf;
  memset(&buf, 0, sizeof(struct sockaddr_storage));
  size_t nr = 0;
  size_t sz = 0;
  switch (addr->sa_family) {
  case AF_INET:
    sz = sizeof(((struct sockaddr_in *)addr)->sin_addr);
    nr = fread(&((struct sockaddr_in *)addr)->sin_addr, 1, sz, f);
    break;
  case AF_INET6:
    sz = sizeof(((struct sockaddr_in6 *)addr)->sin6_addr);
    nr = fread(&((struct sockaddr_in6 *)addr)->sin6_addr, 1, sz, f);
    break;
  default:
    break;
  }
  if (nr != sz) {
    fprintf(stderr, "bind_public: fread(%s) returned %ld != %ld\n",
            "/tmp/bind_public.ip", nr, sizeof(struct sockaddr_storage));
    unlink("/tmp/bind_public.ip");
    return ENODATA;
  }
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<get_cached_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x81,(%rax)
je     11bd <get_cached_ip+0x3d>
mov    -0x10(%rbp),%rax
cmpl   $0x80,(%rax)
je     11bd <get_cached_ip+0x3d>
mov    0x2e0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13f9 <get_cached_ip+0x279>
lea    0xe3c(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1090 <stat@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1224 <get_cached_ip+0xa4>
mov    0x2def(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    0x2db8(%rip),%rcx
cmp    (%rcx),%eax
je     1219 <get_cached_ip+0x99>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%ecx
lea    0xe09(%rip),%rsi
lea    0xdee(%rip),%rdx
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f9 <get_cached_ip+0x279>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1050 <clock_gettime@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1274 <get_cached_ip+0xf4>
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%edx
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f9 <get_cached_ip+0x279>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
add    $0xe10,%rcx
cmp    %rcx,%rax
jle    129d <get_cached_ip+0x11d>
mov    0x2d35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13f9 <get_cached_ip+0x279>
lea    0xd5c(%rip),%rdi
lea    0xdc2(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    12f7 <get_cached_ip+0x177>
mov    0x2d0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
mov    -0x3c(%rbp),%ecx
lea    0xd91(%rip),%rsi
lea    0xd1b(%rip),%rdx
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13f9 <get_cached_ip+0x279>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <memset@plt>
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
sub    $0x80,%eax
je     136a <get_cached_ip+0x1ea>
jmp    1330 <get_cached_ip+0x1b0>
mov    -0x54(%rbp),%eax
sub    $0x81,%eax
jne    1391 <get_cached_ip+0x211>
jmp    1343 <get_cached_ip+0x1c3>
movq   $0x4,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x48(%rbp)
jmp    1396 <get_cached_ip+0x216>
movq   $0x4,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x48(%rbp)
jmp    1396 <get_cached_ip+0x216>
jmp    1396 <get_cached_ip+0x216>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
je     13e9 <get_cached_ip+0x269>
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rcx
lea    0xcda(%rip),%rsi
lea    0xc41(%rip),%rdx
mov    $0x4,%r8d
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    0xc2d(%rip),%rdi
call   1030 <unlink@plt>
mov    0x2c09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13f9 <get_cached_ip+0x279>
mov    -0x38(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cached_ip>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    (%rdi),%eax
and    $0xfffffffe,%eax
cmp    $0x80,%eax
jne    11e2 <get_cached_ip+0x62>
mov    %rdi,%rbx
lea    0xe62(%rip),%rdi
lea    0x18(%rsp),%rsi
call   1090 <stat@plt>
test   %eax,%eax
je     11f6 <get_cached_ip+0x76>
mov    0x2e1d(%rip),%rax
mov    (%rax),%ebp
mov    0x2dec(%rip),%rax
cmp    (%rax),%ebp
je     11eb <get_cached_ip+0x6b>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
lea    0xe29(%rip),%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    11eb <get_cached_ip+0x6b>
mov    0x2dd7(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
call   1050 <clock_gettime@plt>
test   %eax,%eax
je     1231 <get_cached_ip+0xb1>
mov    0x2dbc(%rip),%rax
mov    (%rax),%ebp
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    11eb <get_cached_ip+0x6b>
mov    $0xe10,%eax
add    0x18(%rsp),%rax
cmp    %rax,0x10(%rsp)
jle    124b <get_cached_ip+0xcb>
mov    0x2d7f(%rip),%rax
jmp    11e9 <get_cached_ip+0x69>
lea    0xdae(%rip),%rdi
lea    0xe14(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     12ad <get_cached_ip+0x12d>
mov    %rax,%r14
lea    0x8(%rsp),%rdi
xor    %ebp,%ebp
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <memset@plt>
mov    (%rbx),%eax
and    $0xfffffffe,%eax
cmp    $0x80,%eax
jne    12a0 <get_cached_ip+0x120>
mov    $0x4,%edx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x4,%rax
jne    12cb <get_cached_ip+0x14b>
mov    %r14,%rdi
call   1060 <fclose@plt>
jmp    11eb <get_cached_ip+0x6b>
mov    0x2d1c(%rip),%rax
mov    (%rax),%ebp
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
jmp    11d0 <get_cached_ip+0x50>
mov    0x2d06(%rip),%rcx
mov    (%rcx),%edi
lea    0xdb7(%rip),%rsi
lea    0xd1e(%rip),%rbx
mov    $0x4,%r8d
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    0x2ce4(%rip),%rax
jmp    11e9 <get_cached_ip+0x69>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.stat = type { i64 }
%struct.timespec = type { i64 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr_in = type { i32 }
%struct.sockaddr_in6 = type { i32 }
@EINVAL = global i32 0
@.str = [20 x i8] c"/tmp/bind_public.ip\00"
@errno = global i32 0
@ENOENT = global i32 0
@stderr = global i32 0
@.str.1 = [34 x i8] c"bind_public: stat(%s) errno = %d\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.2 = [55 x i8] c"bind_public: clock_gettime(CLOCK_REALTIME) errno = %d\0A\00"
@ESTALE = global i32 0
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [35 x i8] c"bind_public: fopen(%s) errno = %d\0A\00"
@.str.5 = [44 x i8] c"bind_public: fread(%s) returned %ld != %ld\0A\00"
@ENODATA = global i32 0
define i32 @get_cached_ip(%struct.sockaddr* %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr*
%4 = alloca %struct.stat
%5 = alloca %struct.timespec
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca %struct.sockaddr_storage
%12 = alloca i64
%13 = alloca i64
store %struct.sockaddr* %0, %struct.sockaddr** %3
%14 = load %struct.sockaddr*, %struct.sockaddr** %3
%15 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = icmp ne i32 %16, 129
br i1 %17, label %18, label %25
18: ; preds = %1
%19 = load %struct.sockaddr*, %struct.sockaddr** %3
%20 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = icmp ne i32 %21, 128
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = load i32, i32* @EINVAL
store i32 %24, i32* %2
br label %103
25: ; preds = %18, %1
%26 = call i32 @stat(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.stat* %4)
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %25
%30 = load i32, i32* @errno
store i32 %30, i32* %7
%31 = load i32, i32* %7
%32 = load i32, i32* @ENOENT
%33 = icmp ne i32 %31, %32
br i1 %33, label %34, label %38
34: ; preds = %29
%35 = load i32, i32* @stderr
%36 = load i32, i32* %7
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %34, %29
%39 = load i32, i32* %7
store i32 %39, i32* %2
br label %103
40: ; preds = %25
%41 = load i32, i32* @CLOCK_REALTIME
%42 = call i32 @clock_gettime(i32 %41, %struct.timespec* %5)
store i32 %42, i32* %6
%43 = load i32, i32* %6
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %40
%46 = load i32, i32* @errno
store i32 %46, i32* %8
%47 = load i32, i32* @stderr
%48 = load i32, i32* %8
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %8
store i32 %50, i32* %2
br label %103
51: ; preds = %40
%52 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%53 = load i64, i64* %52
%54 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%55 = load i64, i64* %54
%56 = add nsw i64 %55, 3600
%57 = icmp sgt i64 %53, %56
br i1 %57, label %58, label %60
58: ; preds = %51
%59 = load i32, i32* @ESTALE
store i32 %59, i32* %2
br label %103
60: ; preds = %51
%61 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %61, i32** %9
%62 = load i32*, i32** %9
%63 = icmp ne i32* %62, null
br i1 %63, label %70, label %64
64: ; preds = %60
%65 = load i32, i32* @errno
store i32 %65, i32* %10
%66 = load i32, i32* @stderr
%67 = load i32, i32* %10
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %10
store i32 %69, i32* %2
br label %103
70: ; preds = %60
%71 = call i32 @memset(%struct.sockaddr_storage* %11, i32 0, i32 4)
store i64 0, i64* %12
store i64 0, i64* %13
%72 = load %struct.sockaddr*, %struct.sockaddr** %3
%73 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %72, i32 0, i32 0
%74 = load i32, i32* %73
switch i32 %74, label %89 [
i32 129, label %75
i32 128, label %82
]
75: ; preds = %70
store i64 4, i64* %13
%76 = load %struct.sockaddr*, %struct.sockaddr** %3
%77 = bitcast %struct.sockaddr* %76 to %struct.sockaddr_in*
%78 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %77, i32 0, i32 0
%79 = load i64, i64* %13
%80 = load i32*, i32** %9
%81 = call i64 @fread(i32* %78, i32 1, i64 %79, i32* %80)
store i64 %81, i64* %12
br label %90
82: ; preds = %70
store i64 4, i64* %13
%83 = load %struct.sockaddr*, %struct.sockaddr** %3
%84 = bitcast %struct.sockaddr* %83 to %struct.sockaddr_in6*
%85 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %84, i32 0, i32 0
%86 = load i64, i64* %13
%87 = load i32*, i32** %9
%88 = call i64 @fread(i32* %85, i32 1, i64 %86, i32* %87)
store i64 %88, i64* %12
br label %90
89: ; preds = %70
br label %90
90: ; preds = %89, %82, %75
%91 = load i64, i64* %12
%92 = load i64, i64* %13
%93 = icmp ne i64 %91, %92
br i1 %93, label %94, label %100
94: ; preds = %90
%95 = load i32, i32* @stderr
%96 = load i64, i64* %12
%97 = call i32 (i32, i8*, ...) @fprintf(i32 %95, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %96, i64 4)
%98 = call i32 @unlink(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%99 = load i32, i32* @ENODATA
store i32 %99, i32* %2
br label %103
100: ; preds = %90
%101 = load i32*, i32** %9
%102 = call i32 @fclose(i32* %101)
store i32 0, i32* %2
br label %103
103: ; preds = %100, %94, %64, %58, %45, %38, %23
%104 = load i32, i32* %2
ret i32 %104
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
%struct.stat = type { i64 }
%struct.timespec = type { i64 }
%struct.sockaddr_storage = type { i32 }
@EINVAL = global i32 0
@.str = [20 x i8] c"/tmp/bind_public.ip\00"
@errno = global i32 0
@ENOENT = global i32 0
@stderr = global i32 0
@.str.1 = [34 x i8] c"bind_public: stat(%s) errno = %d\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.2 = [55 x i8] c"bind_public: clock_gettime(CLOCK_REALTIME) errno = %d\0A\00"
@ESTALE = global i32 0
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [35 x i8] c"bind_public: fopen(%s) errno = %d\0A\00"
@.str.5 = [44 x i8] c"bind_public: fread(%s) returned %ld != %ld\0A\00"
@ENODATA = global i32 0
define i32 @get_cached_ip(%struct.sockaddr* nocapture %0) {
%2 = alloca %struct.stat
%3 = alloca %struct.timespec
%4 = alloca %struct.sockaddr_storage
%5 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = and i32 %6, -2
%8 = icmp eq i32 %7, 128
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = load i32, i32* @EINVAL
br label %67
11: ; preds = %1
%12 = bitcast %struct.stat* %2 to i8*
%13 = bitcast %struct.timespec* %3 to i8*
%14 = call i32 @stat(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%15 = icmp eq i32 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %11
%17 = load i32, i32* @errno
%18 = load i32, i32* @ENOENT
%19 = icmp eq i32 %17, %18
br i1 %19, label %65, label %20
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %65
23: ; preds = %11
%24 = load i32, i32* @CLOCK_REALTIME
%25 = call i32 @clock_gettime(i32 %24, %struct.timespec* %3)
%26 = icmp eq i32 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load i32, i32* @errno
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %65
31: ; preds = %23
%32 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%33 = load i64, i64* %32
%34 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%35 = load i64, i64* %34
%36 = add nsw i64 %35, 3600
%37 = icmp sgt i64 %33, %36
br i1 %37, label %38, label %40
38: ; preds = %31
%39 = load i32, i32* @ESTALE
br label %65
40: ; preds = %31
%41 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = load i32, i32* @errno
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %44)
br label %65
47: ; preds = %40
%48 = bitcast %struct.sockaddr_storage* %4 to i8*
%49 = call i32 @memset(%struct.sockaddr_storage* %4, i32 0, i32 4)
%50 = load i32, i32* %5
%51 = and i32 %50, -2
%52 = icmp eq i32 %51, 128
br i1 %52, label %53, label %61
53: ; preds = %47
%54 = call i64 @fread(i32* %5, i32 1, i64 4, i32* %41)
%55 = icmp eq i64 %54, 4
br i1 %55, label %61, label %56
56: ; preds = %53
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %54, i64 4)
%59 = call i32 @unlink(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%60 = load i32, i32* @ENODATA
br label %63
61: ; preds = %47, %53
%62 = call i32 @fclose(i32* %41)
br label %63
63: ; preds = %61, %56
%64 = phi i32 [ %60, %56 ], [ 0, %61 ]
br label %65
65: ; preds = %43, %63, %16, %20, %38, %27
%66 = phi i32 [ %28, %27 ], [ %39, %38 ], [ %17, %20 ], [ %17, %16 ], [ %64, %63 ], [ %44, %43 ]
br label %67
67: ; preds = %65, %9
%68 = phi i32 [ %10, %9 ], [ %66, %65 ]
ret i32 %68
}