#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 sockaddr_in6 {
  int /*<<< orphan*/ sin_addr;
  void *sin_family;
  int /*<<< orphan*/ sin6_addr;
  void *sin6_family;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  void *sin_family;
  int /*<<< orphan*/ sin6_addr;
  void *sin6_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ src_str;
typedef int /*<<< orphan*/ dst6;
typedef int /*<<< orphan*/ dst4;

/* Variables and functions */
void *AF_INET;
void *AF_INET6;
int LOG_CONS;
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int get_src_for_route_to(struct sockaddr *, void *, size_t *);
int inet_pton(void *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in6 *, int /*<<< orphan*/, int);
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ sockaddr_to_string(struct sockaddr *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int main(int argc, char **argv) {
  struct sockaddr_in dst4;
  struct sockaddr_in6 dst6;
  struct sockaddr *dst;
  void *src;
  size_t src_len;
  int r;
  memset(&dst4, 0, sizeof(dst4));
  memset(&dst6, 0, sizeof(dst6));
  dst = NULL;
  if (argc < 2) {
    fprintf(stderr, "usage: %s <ip address>\n", argv[0]);
    fprintf(stderr, "both v4 and v6 IP addresses are supported.\n");
    return 1;
  }
  openlog("testgetroute", LOG_CONS | 0, LOG_USER);
  r = inet_pton(AF_INET, argv[1], &dst4.sin_addr);
  if (r < 0) {
    syslog(LOG_ERR, "inet_pton(AF_INET, %s) : %m", argv[1]);
    return 2;
  }
  if (r == 0) {
    r = inet_pton(AF_INET6, argv[1], &dst6.sin6_addr);
    if (r < 0) {
      syslog(LOG_ERR, "inet_pton(AF_INET6, %s) : %m", argv[1]);
      return 2;
    }
    if (r > 0) {
      dst6.sin6_family = AF_INET6;
      dst = (struct sockaddr *)&dst6;
      src = &dst6.sin6_addr;
      src_len = sizeof(dst6.sin6_addr);
    }
  } else {
    dst4.sin_family = AF_INET;
    dst = (struct sockaddr *)&dst4;
    src = &dst4.sin_addr;
    src_len = sizeof(dst4.sin_addr);
  }
  if (dst) {
    r = get_src_for_route_to(dst, src, &src_len);
    syslog(LOG_DEBUG, "get_src_for_route_to() returned %d", r);
    if (r >= 0) {
      char src_str[128];
      sockaddr_to_string(dst, src_str, sizeof(src_str));
      syslog(LOG_DEBUG, "src=%s", src_str);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
movq   $0x0,-0x58(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11fc <main+0x8c>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe2e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13b2 <main+0x242>
mov    0x2dbd(%rip),%rax
mov    (%rax),%esi
or     $0x0,%esi
mov    0x2dd9(%rip),%rax
mov    (%rax),%edx
lea    0xe2c(%rip),%rdi
call   1090 <openlog@plt>
mov    0x2dbc(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x30(%rbp),%rdx
call   1060 <inet_pton@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
jge    1270 <main+0x100>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdf4(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
movl   $0x2,-0x4(%rbp)
jmp    13b2 <main+0x242>
cmpl   $0x0,-0x6c(%rbp)
jne    130a <main+0x19a>
mov    0x2d57(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x50(%rbp),%rdx
add    $0x10,%rdx
call   1060 <inet_pton@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
jge    12d1 <main+0x161>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdaf(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
movl   $0x2,-0x4(%rbp)
jmp    13b2 <main+0x242>
cmpl   $0x0,-0x6c(%rbp)
jle    1305 <main+0x195>
mov    0x2cf6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x60(%rbp)
movq   $0x4,-0x68(%rbp)
jmp    1330 <main+0x1c0>
mov    0x2ccf(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
movq   $0x4,-0x68(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     13ab <main+0x23b>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
call   1030 <get_src_for_route_to@plt>
mov    %eax,-0x6c(%rbp)
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
mov    -0x6c(%rbp),%edx
lea    0xd28(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
cmpl   $0x0,-0x6c(%rbp)
jl     13a6 <main+0x236>
mov    -0x58(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x80,%edx
call   1070 <sockaddr_to_string@plt>
mov    0x2c29(%rip),%rax
mov    (%rax),%edi
lea    -0xf0(%rbp),%rdx
lea    0xd0e(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
jmp    13ab <main+0x23b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xd8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x30(%rsp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
cmp    $0x1,%ebp
jg     11e2 <main+0x72>
mov    0x2e15(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xe40(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe47(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%ebx
jmp    12ba <main+0x14a>
mov    0x2dd7(%rip),%rax
mov    (%rax),%esi
mov    0x2df6(%rip),%rax
mov    (%rax),%edx
lea    0xe49(%rip),%rdi
call   1090 <openlog@plt>
mov    0x2dd9(%rip),%rbp
mov    0x0(%rbp),%rdi
mov    0x8(%rbx),%rsi
lea    0x30(%rsp),%r15
mov    %r15,%rdx
call   1060 <inet_pton@plt>
test   %eax,%eax
js     129a <main+0x12a>
je     12ca <main+0x15a>
mov    0x0(%rbp),%rax
mov    %rax,0x38(%rsp)
mov    %r15,%r14
movq   $0x4,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <get_src_for_route_to@plt>
mov    %eax,%ebp
mov    0x2d64(%rip),%r15
mov    (%r15),%edi
lea    0xe2c(%rip),%rsi
xor    %ebx,%ebx
mov    %eax,%edx
xor    %eax,%eax
call   1080 <syslog@plt>
test   %ebp,%ebp
js     12ba <main+0x14a>
lea    0x50(%rsp),%rbp
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x80,%edx
call   1070 <sockaddr_to_string@plt>
mov    (%r15),%edi
lea    0xe21(%rip),%rsi
xor    %ebx,%ebx
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <syslog@plt>
jmp    12ba <main+0x14a>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xda3(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
mov    $0x2,%ebx
mov    %ebx,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d07(%rip),%rbp
mov    0x0(%rbp),%rdi
mov    0x8(%rbx),%rsi
lea    0x20(%rsp),%r15
mov    %r15,%rdx
call   1060 <inet_pton@plt>
test   %eax,%eax
js     12fa <main+0x18a>
je     1310 <main+0x1a0>
mov    0x0(%rbp),%rax
mov    %rax,0x28(%rsp)
jmp    1232 <main+0xc2>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xd5f(%rip),%rsi
jmp    12ae <main+0x13e>
xor    %ebx,%ebx
jmp    12ba <main+0x14a>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i8*, i32, i8* }
%struct.sockaddr_in6 = type { i32, i8*, i32, i8* }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [24 x i8] c"usage: %s <ip address>\0A\00"
@.str.1 = [44 x i8] c"both v4 and v6 IP addresses are supported.\0A\00"
@.str.2 = [13 x i8] c"testgetroute\00"
@LOG_CONS = global i32 0
@LOG_USER = global i32 0
@AF_INET = global i8* null
@LOG_ERR = global i32 0
@.str.3 = [28 x i8] c"inet_pton(AF_INET, %s) : %m\00"
@AF_INET6 = global i8* null
@.str.4 = [29 x i8] c"inet_pton(AF_INET6, %s) : %m\00"
@LOG_DEBUG = global i32 0
@.str.5 = [35 x i8] c"get_src_for_route_to() returned %d\00"
@.str.6 = [7 x i8] c"src=%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_in6
%8 = alloca %struct.sockaddr*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr_in6*
%14 = call i32 @memset(%struct.sockaddr_in6* %13, i32 0, i32 32)
%15 = call i32 @memset(%struct.sockaddr_in6* %7, i32 0, i32 32)
store %struct.sockaddr* null, %struct.sockaddr** %8
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %26
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %100
26: ; preds = %2
%27 = load i32, i32* @LOG_CONS
%28 = or i32 %27, 0
%29 = load i32, i32* @LOG_USER
%30 = call i32 @openlog(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29)
%31 = load i8*, i8** @AF_INET
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%36 = call i32 @inet_pton(i8* %31, i8* %34, i32* %35)
store i32 %36, i32* %11
%37 = load i32, i32* %11
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %45
39: ; preds = %26
%40 = load i32, i32* @LOG_ERR
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 (i32, i8*, ...) @syslog(i32 %40, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %43)
store i32 2, i32* %3
br label %100
45: ; preds = %26
%46 = load i32, i32* %11
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %73
48: ; preds = %45
%49 = load i8*, i8** @AF_INET6
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %7, i32 0, i32 2
%54 = call i32 @inet_pton(i8* %49, i8* %52, i32* %53)
store i32 %54, i32* %11
%55 = load i32, i32* %11
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %48
%58 = load i32, i32* @LOG_ERR
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i32 (i32, i8*, ...) @syslog(i32 %58, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %61)
store i32 2, i32* %3
br label %100
63: ; preds = %48
%64 = load i32, i32* %11
%65 = icmp sgt i32 %64, 0
br i1 %65, label %66, label %72
66: ; preds = %63
%67 = load i8*, i8** @AF_INET6
%68 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %7, i32 0, i32 3
store i8* %67, i8** %68
%69 = bitcast %struct.sockaddr_in6* %7 to %struct.sockaddr*
store %struct.sockaddr* %69, %struct.sockaddr** %8
%70 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %7, i32 0, i32 2
%71 = bitcast i32* %70 to i8*
store i8* %71, i8** %9
store i64 4, i64* %10
br label %72
72: ; preds = %66, %63
br label %79
73: ; preds = %45
%74 = load i8*, i8** @AF_INET
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i8* %74, i8** %75
%76 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
store %struct.sockaddr* %76, %struct.sockaddr** %8
%77 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%78 = bitcast i32* %77 to i8*
store i8* %78, i8** %9
store i64 4, i64* %10
br label %79
79: ; preds = %73, %72
%80 = load %struct.sockaddr*, %struct.sockaddr** %8
%81 = icmp ne %struct.sockaddr* %80, null
br i1 %81, label %82, label %99
82: ; preds = %79
%83 = load %struct.sockaddr*, %struct.sockaddr** %8
%84 = load i8*, i8** %9
%85 = call i32 @get_src_for_route_to(%struct.sockaddr* %83, i8* %84, i64* %10)
store i32 %85, i32* %11
%86 = load i32, i32* @LOG_DEBUG
%87 = load i32, i32* %11
%88 = call i32 (i32, i8*, ...) @syslog(i32 %86, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %11
%90 = icmp sge i32 %89, 0
br i1 %90, label %91, label %98
91: ; preds = %82
%92 = load %struct.sockaddr*, %struct.sockaddr** %8
%93 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%94 = call i32 @sockaddr_to_string(%struct.sockaddr* %92, i8* %93, i32 128)
%95 = load i32, i32* @LOG_DEBUG
%96 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%97 = call i32 (i32, i8*, ...) @syslog(i32 %95, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %96)
br label %98
98: ; preds = %91, %82
br label %99
99: ; preds = %98, %79
store i32 0, i32* %3
br label %100
100: ; preds = %99, %57, %39, %18
%101 = load i32, i32* %3
ret i32 %101
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i8*, i32, i8* }
%struct.sockaddr_in6 = type { i32, i8*, i32, i8* }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [24 x i8] c"usage: %s <ip address>\0A\00"
@.str.1 = [44 x i8] c"both v4 and v6 IP addresses are supported.\0A\00"
@.str.2 = [13 x i8] c"testgetroute\00"
@LOG_CONS = global i32 0
@LOG_USER = global i32 0
@AF_INET = global i8* null
@LOG_ERR = global i32 0
@.str.3 = [28 x i8] c"inet_pton(AF_INET, %s) : %m\00"
@AF_INET6 = global i8* null
@.str.4 = [29 x i8] c"inet_pton(AF_INET6, %s) : %m\00"
@LOG_DEBUG = global i32 0
@.str.5 = [35 x i8] c"get_src_for_route_to() returned %d\00"
@.str.6 = [7 x i8] c"src=%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in6
%5 = alloca i64
%6 = alloca [128 x i8]
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast %struct.sockaddr_in6* %4 to i8*
%9 = bitcast i64* %5 to i8*
%10 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr_in6*
%11 = call i32 @memset(%struct.sockaddr_in6* %10, i32 0, i32 32)
%12 = call i32 @memset(%struct.sockaddr_in6* %4, i32 0, i32 32)
%13 = icmp slt i32 %0, 2
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %69
20: ; preds = %2
%21 = load i32, i32* @LOG_CONS
%22 = load i32, i32* @LOG_USER
%23 = call i32 @openlog(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i8*, i8** @AF_INET
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%28 = call i32 @inet_pton(i8* %24, i8* %26, i32* %27)
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %20
%31 = load i32, i32* @LOG_ERR
%32 = load i8*, i8** %25
%33 = call i32 (i32, i8*, ...) @syslog(i32 %31, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %32)
br label %69
34: ; preds = %20
%35 = icmp eq i32 %28, 0
br i1 %35, label %36, label %53
36: ; preds = %34
%37 = load i8*, i8** @AF_INET6
%38 = load i8*, i8** %25
%39 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %4, i64 0, i32 2
%40 = call i32 @inet_pton(i8* %37, i8* %38, i32* %39)
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %36
%43 = load i32, i32* @LOG_ERR
%44 = load i8*, i8** %25
%45 = call i32 (i32, i8*, ...) @syslog(i32 %43, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %44)
br label %69
46: ; preds = %36
%47 = icmp eq i32 %40, 0
br i1 %47, label %69, label %48
48: ; preds = %46
%49 = load i8*, i8** @AF_INET6
%50 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %4, i64 0, i32 3
store i8* %49, i8** %50
%51 = bitcast %struct.sockaddr_in6* %4 to %struct.sockaddr*
%52 = bitcast i32* %39 to i8*
br label %57
53: ; preds = %34
%54 = load i8*, i8** @AF_INET
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i8* %54, i8** %55
%56 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
br label %57
57: ; preds = %48, %53
%58 = phi %struct.sockaddr* [ %56, %53 ], [ %51, %48 ]
%59 = phi i8* [ %7, %53 ], [ %52, %48 ]
store i64 4, i64* %5
%60 = call i32 @get_src_for_route_to(%struct.sockaddr* %58, i8* %59, i64* %5)
%61 = load i32, i32* @LOG_DEBUG
%62 = call i32 (i32, i8*, ...) @syslog(i32 %61, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %60)
%63 = icmp sgt i32 %60, -1
br i1 %63, label %64, label %69
64: ; preds = %57
%65 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%66 = call i32 @sockaddr_to_string(%struct.sockaddr* %58, i8* %65, i32 128)
%67 = load i32, i32* @LOG_DEBUG
%68 = call i32 (i32, i8*, ...) @syslog(i32 %67, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %65)
br label %69
69: ; preds = %46, %64, %57, %42, %30, %14
%70 = phi i32 [ 1, %14 ], [ 2, %30 ], [ 2, %42 ], [ 0, %57 ], [ 0, %64 ], [ 0, %46 ]
ret i32 %70
}