#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 */
typedef int time_t;
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ remote_addr;
typedef int /*<<< orphan*/ local_addr;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ INADDR_LOOPBACK;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int errno;
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
scalar_t__ init_dns_tcp_conn();
int /*<<< orphan*/ load_dns_blacklist();
int /*<<< orphan*/ log_func(int, char *, ...);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int /*<<< orphan*/ send_dns_req_over_tcp(char *, int);
int /*<<< orphan*/ send_keep_alive_packet();
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int time(int /*<<< orphan*/ *);
int dns_proxy_loop() {
  int sockfd;
  struct sockaddr_in local_addr, remote_addr;
  socklen_t addrlen = sizeof(remote_addr);
  int retval;
  int recvlen;
  char buf[4096];
  fd_set rfds;
  struct timeval tv;
  time_t now, last_ack_time;
  load_dns_blacklist();
  if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
    log_func(0, "dns_main_loop: Cannot create DNS socket.");
    return -1;
  }
  memset((char *)&local_addr, 0, sizeof(local_addr));
  local_addr.sin_family = AF_INET;
  local_addr.sin_port = htons(5305);
  local_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
  if (bind(sockfd, (struct sockaddr *)&local_addr, sizeof(local_addr)) < 0) {
    log_func(0, "dns_main_loop: Bind failed.");
    return -1;
  }
  if (init_dns_tcp_conn() < 0) {
    log_func(0, "dns_main_loop: Init DNS TCP conn failed.");
    return -1;
  }
  last_ack_time = time(NULL);
  while (1) {
    FD_ZERO(&rfds);
    FD_SET(sockfd, &rfds);
    tv.tv_sec = 1;
    tv.tv_usec = 0;
    retval = select(sockfd + 1, &rfds, NULL, NULL, &tv);
    if (retval == -1)
      log_func(0, "select() failed. errno: %d", errno);
    else if (retval) {
      recvlen = recvfrom(sockfd, buf, 4096, 0, (struct sockaddr *)&remote_addr,
                         &addrlen);
      log_func(4, "received %d bytes", recvlen);
      if (recvlen > 0) {
        send_dns_req_over_tcp(buf, recvlen);
      }
    }
    now = time(NULL);
    if (now - last_ack_time > 7) {
      send_keep_alive_packet();
      last_ack_time = now;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<dns_proxy_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1060,%rsp
movl   $0xc,-0x2c(%rbp)
mov    $0x0,%al
call   1090 <load_dns_blacklist@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
mov    0x2dc7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    124a <dns_proxy_loop+0x5a>
xor    %edi,%edi
lea    0xdc9(%rip),%rsi
mov    $0x0,%al
call   10e0 <log_func@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1412 <dns_proxy_loop+0x222>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    $0x14b9,%edi
call   1040 <htons@plt>
mov    %eax,-0x14(%rbp)
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
call   1050 <htonl@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <bind@plt>
cmp    $0x0,%rax
jge    12bb <dns_proxy_loop+0xcb>
xor    %edi,%edi
lea    0xd81(%rip),%rsi
mov    $0x0,%al
call   10e0 <log_func@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1412 <dns_proxy_loop+0x222>
mov    $0x0,%al
call   1080 <init_dns_tcp_conn@plt>
cmp    $0x0,%rax
jge    12e8 <dns_proxy_loop+0xf8>
xor    %edi,%edi
lea    0xd70(%rip),%rsi
mov    $0x0,%al
call   10e0 <log_func@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1412 <dns_proxy_loop+0x222>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x1060(%rbp)
lea    -0x1044(%rbp),%rdi
call   10b0 <FD_ZERO@plt>
mov    -0x8(%rbp),%edi
lea    -0x1044(%rbp),%rsi
call   1100 <FD_SET@plt>
movl   $0x1,-0x1058(%rbp)
movq   $0x0,-0x1050(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
lea    -0x1044(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x1058(%rbp),%r8
mov    %rcx,%rdx
call   10c0 <select@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    1372 <dns_proxy_loop+0x182>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
lea    0xd08(%rip),%rsi
mov    $0x0,%al
call   10e0 <log_func@plt>
jmp    13d6 <dns_proxy_loop+0x1e6>
cmpl   $0x0,-0x30(%rbp)
je     13d1 <dns_proxy_loop+0x1e1>
mov    -0x8(%rbp),%edi
lea    -0x1040(%rbp),%rsi
lea    -0x28(%rbp),%r8
mov    $0x1000,%edx
xor    %ecx,%ecx
lea    -0x2c(%rbp),%r9
call   10d0 <recvfrom@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edx
mov    $0x4,%edi
lea    0xcdd(%rip),%rsi
mov    $0x0,%al
call   10e0 <log_func@plt>
cmpl   $0x0,-0x34(%rbp)
jle    13cc <dns_proxy_loop+0x1dc>
lea    -0x1040(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <send_dns_req_over_tcp@plt>
jmp    13d1 <dns_proxy_loop+0x1e1>
jmp    13d6 <dns_proxy_loop+0x1e6>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x105c(%rbp)
mov    -0x105c(%rbp),%eax
sub    -0x1060(%rbp),%eax
cmp    $0x7,%eax
jle    140d <dns_proxy_loop+0x21d>
mov    $0x0,%al
call   1070 <send_keep_alive_packet@plt>
mov    -0x105c(%rbp),%eax
mov    %eax,-0x1060(%rbp)
jmp    12f7 <dns_proxy_loop+0x107>
mov    -0x4(%rbp),%eax
add    $0x1060,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_proxy_loop>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1048,%rsp
movl   $0xc,0xc(%rsp)
xor    %eax,%eax
call   1090 <load_dns_blacklist@plt>
mov    0x2dd1(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2dbf(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
js     138f <dns_proxy_loop+0x19f>
mov    %eax,%r14d
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    $0x14b9,%edi
call   1040 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
call   1050 <htonl@plt>
mov    %eax,0x10(%rsp)
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10f0 <bind@plt>
test   %rax,%rax
js     1398 <dns_proxy_loop+0x1a8>
xor    %eax,%eax
call   1080 <init_dns_tcp_conn@plt>
test   %rax,%rax
js     13a1 <dns_proxy_loop+0x1b1>
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%r15d
mov    %r14d,%r13d
add    $0x1,%r13d
lea    0x1c(%rsp),%rbx
jmp    12ee <dns_proxy_loop+0xfe>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2d01(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
lea    0xd9c(%rip),%rsi
xor    %eax,%eax
call   10e0 <log_func@plt>
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%ebp
sub    %r15d,%eax
cmp    $0x8,%eax
jge    1380 <dns_proxy_loop+0x190>
mov    %rbx,%rdi
call   10b0 <FD_ZERO@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1100 <FD_SET@plt>
movl   $0x1,0x20(%rsp)
movq   $0x0,0x28(%rsp)
mov    %r13d,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
lea    0x20(%rsp),%r8
call   10c0 <select@plt>
test   %eax,%eax
je     12d9 <dns_proxy_loop+0xe9>
cmp    $0xffffffff,%eax
je     12c0 <dns_proxy_loop+0xd0>
mov    %r14d,%edi
lea    0x40(%rsp),%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
lea    0x30(%rsp),%r8
lea    0xc(%rsp),%r9
call   10d0 <recvfrom@plt>
mov    %eax,%r12d
mov    $0x4,%edi
lea    0xd2d(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10e0 <log_func@plt>
test   %r12d,%r12d
jle    12d9 <dns_proxy_loop+0xe9>
lea    0x40(%rsp),%rdi
mov    %r12d,%esi
call   1030 <send_dns_req_over_tcp@plt>
jmp    12d9 <dns_proxy_loop+0xe9>
xor    %eax,%eax
call   1070 <send_keep_alive_packet@plt>
mov    %ebp,%r15d
jmp    12ee <dns_proxy_loop+0xfe>
lea    0xc6a(%rip),%rsi
jmp    13a8 <dns_proxy_loop+0x1b8>
lea    0xc8a(%rip),%rsi
jmp    13a8 <dns_proxy_loop+0x1b8>
lea    0xc9d(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   10e0 <log_func@plt>
mov    $0xffffffff,%eax
add    $0x1048,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [41 x i8] c"dns_main_loop: Cannot create DNS socket.\00"
@INADDR_LOOPBACK = global i32 0
@.str.1 = [28 x i8] c"dns_main_loop: Bind failed.\00"
@.str.2 = [41 x i8] c"dns_main_loop: Init DNS TCP conn failed.\00"
@.str.3 = [27 x i8] c"select() failed. errno: %d\00"
@errno = global i32 0
@.str.4 = [18 x i8] c"received %d bytes\00"
define i32 @dns_proxy_loop() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [4096 x i8]
%9 = alloca i32
%10 = alloca %struct.timeval
%11 = alloca i32
%12 = alloca i32
store i32 12, i32* %5
%13 = call i32 (...) @load_dns_blacklist()
%14 = load i32, i32* @AF_INET
%15 = load i32, i32* @SOCK_DGRAM
%16 = call i32 @socket(i32 %14, i32 %15, i32 0)
store i32 %16, i32* %2
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 (i32, i8*, ...) @log_func(i32 0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %86
20: ; preds = %0
%21 = bitcast %struct.sockaddr_in* %3 to i8*
%22 = call i32 @memset(i8* %21, i32 0, i32 12)
%23 = load i32, i32* @AF_INET
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 2
store i32 %23, i32* %24
%25 = call i32 @htons(i32 5305)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
store i32 %25, i32* %26
%27 = load i32, i32* @INADDR_LOOPBACK
%28 = call i32 @htonl(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%30 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %29, i32 0, i32 0
store i32 %28, i32* %30
%31 = load i32, i32* %2
%32 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%33 = call i64 @bind(i32 %31, %struct.sockaddr* %32, i32 12)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %20
%36 = call i32 (i32, i8*, ...) @log_func(i32 0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %86
37: ; preds = %20
%38 = call i64 (...) @init_dns_tcp_conn()
%39 = icmp slt i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (i32, i8*, ...) @log_func(i32 0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %86
42: ; preds = %37
%43 = call i32 @time(i32* null)
store i32 %43, i32* %12
br label %44
44: ; preds = %42, %85
%45 = call i32 @FD_ZERO(i32* %9)
%46 = load i32, i32* %2
%47 = call i32 @FD_SET(i32 %46, i32* %9)
%48 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
store i32 1, i32* %48
%49 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
store i64 0, i64* %49
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
%52 = call i32 @select(i32 %51, i32* %9, i32* null, i32* null, %struct.timeval* %10)
store i32 %52, i32* %6
%53 = load i32, i32* %6
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %58
55: ; preds = %44
%56 = load i32, i32* @errno
%57 = call i32 (i32, i8*, ...) @log_func(i32 0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %56)
br label %76
58: ; preds = %44
%59 = load i32, i32* %6
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %75
61: ; preds = %58
%62 = load i32, i32* %2
%63 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%64 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%65 = call i32 @recvfrom(i32 %62, i8* %63, i32 4096, i32 0, %struct.sockaddr* %64, i32* %5)
store i32 %65, i32* %7
%66 = load i32, i32* %7
%67 = call i32 (i32, i8*, ...) @log_func(i32 4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %7
%69 = icmp sgt i32 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %61
%71 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%72 = load i32, i32* %7
%73 = call i32 @send_dns_req_over_tcp(i8* %71, i32 %72)
br label %74
74: ; preds = %70, %61
br label %75
75: ; preds = %74, %58
br label %76
76: ; preds = %75, %55
%77 = call i32 @time(i32* null)
store i32 %77, i32* %11
%78 = load i32, i32* %11
%79 = load i32, i32* %12
%80 = sub nsw i32 %78, %79
%81 = icmp sgt i32 %80, 7
br i1 %81, label %82, label %85
82: ; preds = %76
%83 = call i32 (...) @send_keep_alive_packet()
%84 = load i32, i32* %11
store i32 %84, i32* %12
br label %85
85: ; preds = %82, %76
br label %44
86: ; preds = %40, %35, %18
%87 = load i32, i32* %1
ret i32 %87
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [41 x i8] c"dns_main_loop: Cannot create DNS socket.\00"
@INADDR_LOOPBACK = global i32 0
@.str.1 = [28 x i8] c"dns_main_loop: Bind failed.\00"
@.str.2 = [41 x i8] c"dns_main_loop: Init DNS TCP conn failed.\00"
@.str.3 = [27 x i8] c"select() failed. errno: %d\00"
@errno = global i32 0
@.str.4 = [18 x i8] c"received %d bytes\00"
define i32 @dns_proxy_loop() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [4096 x i8]
%5 = alloca i32
%6 = alloca %struct.timeval
%7 = bitcast %struct.sockaddr_in* %1 to i8*
%8 = bitcast %struct.sockaddr_in* %2 to i8*
%9 = bitcast i32* %3 to i8*
store i32 12, i32* %3
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %4, i64 0, i64 0
%11 = bitcast i32* %5 to i8*
%12 = bitcast %struct.timeval* %6 to i8*
%13 = tail call i32 (...) @load_dns_blacklist()
%14 = load i32, i32* @AF_INET
%15 = load i32, i32* @SOCK_DGRAM
%16 = tail call i32 @socket(i32 %14, i32 %15, i32 0)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = tail call i32 (i32, i8*, ...) @log_func(i32 0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %66
20: ; preds = %0
%21 = call i32 @memset(i8* %7, i32 0, i32 12)
%22 = load i32, i32* @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %22, i32* %23
%24 = call i32 @htons(i32 5305)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1
store i32 %24, i32* %25
%26 = load i32, i32* @INADDR_LOOPBACK
%27 = call i32 @htonl(i32 %26)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0, i32 0
store i32 %27, i32* %28
%29 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%30 = call i64 @bind(i32 %16, %struct.sockaddr* %29, i32 12)
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %20
%33 = call i32 (i32, i8*, ...) @log_func(i32 0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %66
34: ; preds = %20
%35 = call i64 (...) @init_dns_tcp_conn()
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (i32, i8*, ...) @log_func(i32 0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %66
39: ; preds = %34
%40 = call i32 @time(i32* null)
%41 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%42 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 1
%43 = add nuw nsw i32 %16, 1
%44 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
br label %45
45: ; preds = %64, %39
%46 = phi i32 [ %61, %64 ], [ %40, %39 ]
br label %47
47: ; preds = %45, %60
%48 = call i32 @FD_ZERO(i32* %5)
%49 = call i32 @FD_SET(i32 %16, i32* %5)
store i32 1, i32* %41
store i64 0, i64* %42
%50 = call i32 @select(i32 %43, i32* %5, i32* null, i32* null, %struct.timeval* %6)
switch i32 %50, label %54 [
i32 -1, label %51
i32 0, label %60
]
51: ; preds = %47
%52 = load i32, i32* @errno
%53 = call i32 (i32, i8*, ...) @log_func(i32 0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %52)
br label %60
54: ; preds = %47
%55 = call i32 @recvfrom(i32 %16, i8* %10, i32 4096, i32 0, %struct.sockaddr* %44, i32* %3)
%56 = call i32 (i32, i8*, ...) @log_func(i32 4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %55)
%57 = icmp sgt i32 %55, 0
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 @send_dns_req_over_tcp(i8* %10, i32 %55)
br label %60
60: ; preds = %47, %58, %54, %51
%61 = call i32 @time(i32* null)
%62 = sub nsw i32 %61, %46
%63 = icmp sgt i32 %62, 7
br i1 %63, label %64, label %47
64: ; preds = %60
%65 = call i32 (...) @send_keep_alive_packet()
br label %45
66: ; preds = %37, %32, %18
ret i32 -1
}