#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*/ sin6_addr;
};
struct in6_addr {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *, char *, char *, char *,
                  char *, char *, char *, char *, int *, int *, int *, int *,
                  char *);
int /*<<< orphan*/ inet_pton(int /*<<< orphan*/, char *, struct sockaddr_in6 *);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, struct sockaddr_in6 *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char *, char *, char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int get_ipv6_address(char *ifname, struct sockaddr_in6 *saddr6, int scope_in) {
  char addr6[40], devname[11];
  char addr6p[8][5];
  int plen, scope, dad_status, if_idx;
  FILE *f;
  struct sockaddr_in6 tmp_sockaddr6;
  if ((f = fopen("/proc/net/if_inet6", "r")) != NULL) {
    while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
                  addr6p[0], addr6p[1], addr6p[2], addr6p[3], addr6p[4],
                  addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope,
                  &dad_status, devname) != EOF) {
      if (!strcmp(devname, ifname)) {
        sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s", addr6p[0], addr6p[1],
                addr6p[2], addr6p[3], addr6p[4], addr6p[5], addr6p[6],
                addr6p[7]);
        printf("\t inet6 addr: %s\n", addr6);
        printf("\t Scope: %d\n", scope);
        if (scope == scope_in) {
          printf("\tFound GLOBAL addr: %s:%s:%s:%s:%s:%s:%s:%s\n", addr6p[0],
                 addr6p[1], addr6p[2], addr6p[3], addr6p[4], addr6p[5],
                 addr6p[6], addr6p[7]);
          inet_pton(AF_INET6, addr6, &tmp_sockaddr6);
          memcpy(&saddr6->sin6_addr, &tmp_sockaddr6, sizeof(struct in6_addr));
          fclose(f);
          return 1;
        }
      }
    }
    fclose(f);
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_ipv6_address>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %edx,-0x44(%rbp)
lea    0xe5a(%rip),%rdi
lea    0xe66(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xc8(%rbp)
cmp    $0x0,%rax
je     1427 <get_ipv6_address+0x2a7>
jmp    11c8 <get_ipv6_address+0x48>
mov    -0xc8(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
add    $0x5,%rcx
lea    -0xb0(%rbp),%r8
add    $0xa,%r8
lea    -0xb0(%rbp),%r9
add    $0xf,%r9
lea    -0xb0(%rbp),%rax
add    $0x14,%rax
lea    -0xb0(%rbp),%r13
add    $0x19,%r13
lea    -0xb0(%rbp),%r12
add    $0x1e,%r12
lea    -0xb0(%rbp),%r15
add    $0x23,%r15
lea    -0x7b(%rbp),%rsi
mov    %rsi,-0xd8(%rbp)
lea    0xde0(%rip),%rsi
lea    -0xc0(%rbp),%r14
lea    -0xb4(%rbp),%rbx
lea    -0xb8(%rbp),%r11
lea    -0xbc(%rbp),%r10
mov    %rax,(%rsp)
mov    -0xd8(%rbp),%rax
mov    %r13,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    %r15,0x18(%rsp)
mov    %r14,0x20(%rsp)
mov    %rbx,0x28(%rsp)
mov    %r11,0x30(%rsp)
mov    %r10,0x38(%rsp)
mov    %rax,0x40(%rsp)
call   1050 <fscanf@plt>
mov    0x2d58(%rip),%rcx
cmp    (%rcx),%rax
je     141b <get_ipv6_address+0x29b>
lea    -0x7b(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1416 <get_ipv6_address+0x296>
lea    -0x70(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
add    $0x5,%rcx
lea    -0xb0(%rbp),%r8
add    $0xa,%r8
lea    -0xb0(%rbp),%r9
add    $0xf,%r9
lea    -0xb0(%rbp),%rbx
add    $0x14,%rbx
lea    -0xb0(%rbp),%r11
add    $0x19,%r11
lea    -0xb0(%rbp),%r10
add    $0x1e,%r10
lea    -0xb0(%rbp),%rax
add    $0x23,%rax
lea    0xd3a(%rip),%rsi
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   10a0 <sprintf@plt>
lea    -0x70(%rbp),%rsi
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xb8(%rbp),%esi
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xb8(%rbp),%eax
cmp    -0x44(%rbp),%eax
jne    1411 <get_ipv6_address+0x291>
lea    -0xb0(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
add    $0x5,%rdx
lea    -0xb0(%rbp),%rcx
add    $0xa,%rcx
lea    -0xb0(%rbp),%r8
add    $0xf,%r8
lea    -0xb0(%rbp),%r9
add    $0x14,%r9
lea    -0xb0(%rbp),%r11
add    $0x19,%r11
lea    -0xb0(%rbp),%r10
add    $0x1e,%r10
lea    -0xb0(%rbp),%rax
add    $0x23,%rax
lea    0xcc9(%rip),%rdi
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c0e(%rip),%rax
mov    (%rax),%edi
lea    -0x70(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
call   1080 <inet_pton@plt>
mov    -0x40(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x2c(%rbp)
jmp    142e <get_ipv6_address+0x2ae>
jmp    1416 <get_ipv6_address+0x296>
jmp    11c8 <get_ipv6_address+0x48>
mov    -0xc8(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ipv6_address>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %edx,0x44(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbp
lea    0xe5e(%rip),%rdi
lea    0xe6a(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     133e <get_ipv6_address+0x1be>
mov    %rax,%rbx
mov    %r14,0x48(%rsp)
lea    0x1a(%rsp),%r13
lea    0x65(%rsp),%r14
lea    0x10(%rsp),%r15
xchg   %ax,%ax
sub    $0x8,%rsp
mov    %rbx,%rdi
lea    0xe37(%rip),%rsi
mov    %r15,%rdx
lea    0x1d(%rsp),%rcx
mov    %r13,%r8
lea    0x27(%rsp),%r9
push   %r14
lea    0x6c(%rsp),%rax
push   %rax
lea    0x24(%rsp),%rax
push   %rax
lea    0x80(%rsp),%rax
push   %rax
lea    0x80(%rsp),%rax
push   %rax
lea    0x63(%rsp),%rax
push   %rax
lea    0x66(%rsp),%rax
push   %rax
lea    0x69(%rsp),%rax
push   %rax
lea    0x6c(%rsp),%rax
push   %rax
call   1050 <fscanf@plt>
add    $0x50,%rsp
mov    0x2db2(%rip),%rcx
cmp    (%rcx),%rax
je     1332 <get_ipv6_address+0x1b2>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
jne    11d0 <get_ipv6_address+0x50>
lea    0x70(%rsp),%r12
mov    %r12,%rdi
lea    0xdeb(%rip),%rsi
mov    %r15,%rdx
lea    0x15(%rsp),%rcx
mov    %r13,%r8
lea    0x1f(%rsp),%r9
lea    0x33(%rsp),%rax
push   %rax
lea    0x36(%rsp),%rax
push   %rax
lea    0x39(%rsp),%rax
push   %rax
lea    0x3c(%rsp),%rax
push   %rax
call   10a0 <sprintf@plt>
add    $0x20,%rsp
lea    0xdcb(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xdc8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x44(%rsp),%eax
cmp    %eax,0xc(%rsp)
jne    11d0 <get_ipv6_address+0x50>
sub    $0x8,%rsp
lea    0xdb5(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x1d(%rsp),%rdx
mov    %r13,%rcx
lea    0x27(%rsp),%r8
lea    0x2c(%rsp),%r9
xor    %eax,%eax
lea    0x3b(%rsp),%rbp
push   %rbp
lea    0x3e(%rsp),%rbp
push   %rbp
lea    0x41(%rsp),%rbp
push   %rbp
call   1040 <printf@plt>
add    $0x20,%rsp
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
lea    0x70(%rsp),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdx
call   1080 <inet_pton@plt>
mov    0x48(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x4,%edx
call   1070 <memcpy@plt>
mov    $0x1,%ebp
jmp    1334 <get_ipv6_address+0x1b4>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    1340 <get_ipv6_address+0x1c0>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in6 = type { i32 }
@.str = [19 x i8] c"/proc/net/if_inet6\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [51 x i8] c"%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\0A\00"
@EOF = global i64 0
@.str.3 = [24 x i8] c"%s:%s:%s:%s:%s:%s:%s:%s\00"
@.str.4 = [18 x i8] c"\09 inet6 addr: %s\0A\00"
@.str.5 = [13 x i8] c"\09 Scope: %d\0A\00"
@.str.6 = [45 x i8] c"\09Found GLOBAL addr: %s:%s:%s:%s:%s:%s:%s:%s\0A\00"
@AF_INET6 = global i32 0
define i32 @get_ipv6_address(i8* %0, %struct.sockaddr_in6* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca %struct.sockaddr_in6*
%7 = alloca i32
%8 = alloca [40 x i8]
%9 = alloca [11 x i8]
%10 = alloca [8 x [5 x i8]]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
%16 = alloca %struct.sockaddr_in6
store i8* %0, i8** %5
store %struct.sockaddr_in6* %1, %struct.sockaddr_in6** %6
store i32 %2, i32* %7
%17 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %15
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %104
19: ; preds = %3
br label %20
20: ; preds = %100, %19
%21 = load i32*, i32** %15
%22 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 0
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %22, i64 0, i64 0
%24 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 1
%25 = getelementptr inbounds [5 x i8], [5 x i8]* %24, i64 0, i64 0
%26 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 2
%27 = getelementptr inbounds [5 x i8], [5 x i8]* %26, i64 0, i64 0
%28 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 3
%29 = getelementptr inbounds [5 x i8], [5 x i8]* %28, i64 0, i64 0
%30 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 4
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %30, i64 0, i64 0
%32 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 5
%33 = getelementptr inbounds [5 x i8], [5 x i8]* %32, i64 0, i64 0
%34 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 6
%35 = getelementptr inbounds [5 x i8], [5 x i8]* %34, i64 0, i64 0
%36 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 7
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %36, i64 0, i64 0
%38 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%39 = call i64 @fscanf(i32* %21, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8* %25, i8* %27, i8* %29, i8* %31, i8* %33, i8* %35, i8* %37, i32* %14, i32* %11, i32* %12, i32* %13, i8* %38)
%40 = load i64, i64* @EOF
%41 = icmp ne i64 %39, %40
br i1 %41, label %42, label %101
42: ; preds = %20
%43 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%44 = load i8*, i8** %5
%45 = call i32 @strcmp(i8* %43, i8* %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %100, label %47
47: ; preds = %42
%48 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%49 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 0
%50 = getelementptr inbounds [5 x i8], [5 x i8]* %49, i64 0, i64 0
%51 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 1
%52 = getelementptr inbounds [5 x i8], [5 x i8]* %51, i64 0, i64 0
%53 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 2
%54 = getelementptr inbounds [5 x i8], [5 x i8]* %53, i64 0, i64 0
%55 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 3
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %55, i64 0, i64 0
%57 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 4
%58 = getelementptr inbounds [5 x i8], [5 x i8]* %57, i64 0, i64 0
%59 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 5
%60 = getelementptr inbounds [5 x i8], [5 x i8]* %59, i64 0, i64 0
%61 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 6
%62 = getelementptr inbounds [5 x i8], [5 x i8]* %61, i64 0, i64 0
%63 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 7
%64 = getelementptr inbounds [5 x i8], [5 x i8]* %63, i64 0, i64 0
%65 = call i32 @sprintf(i8* %48, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %50, i8* %52, i8* %54, i8* %56, i8* %58, i8* %60, i8* %62, i8* %64)
%66 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %66)
%68 = load i32, i32* %12
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %12
%71 = load i32, i32* %7
%72 = icmp eq i32 %70, %71
br i1 %72, label %73, label %99
73: ; preds = %47
%74 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 0
%75 = getelementptr inbounds [5 x i8], [5 x i8]* %74, i64 0, i64 0
%76 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 1
%77 = getelementptr inbounds [5 x i8], [5 x i8]* %76, i64 0, i64 0
%78 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 2
%79 = getelementptr inbounds [5 x i8], [5 x i8]* %78, i64 0, i64 0
%80 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 3
%81 = getelementptr inbounds [5 x i8], [5 x i8]* %80, i64 0, i64 0
%82 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 4
%83 = getelementptr inbounds [5 x i8], [5 x i8]* %82, i64 0, i64 0
%84 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 5
%85 = getelementptr inbounds [5 x i8], [5 x i8]* %84, i64 0, i64 0
%86 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 6
%87 = getelementptr inbounds [5 x i8], [5 x i8]* %86, i64 0, i64 0
%88 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %10, i64 0, i64 7
%89 = getelementptr inbounds [5 x i8], [5 x i8]* %88, i64 0, i64 0
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* %75, i8* %77, i8* %79, i8* %81, i8* %83, i8* %85, i8* %87, i8* %89)
%91 = load i32, i32* @AF_INET6
%92 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%93 = call i32 @inet_pton(i32 %91, i8* %92, %struct.sockaddr_in6* %16)
%94 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %6
%95 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %94, i32 0, i32 0
%96 = call i32 @memcpy(i32* %95, %struct.sockaddr_in6* %16, i32 4)
%97 = load i32*, i32** %15
%98 = call i32 @fclose(i32* %97)
store i32 1, i32* %4
br label %105
99: ; preds = %47
br label %100
100: ; preds = %99, %42
br label %20
101: ; preds = %20
%102 = load i32*, i32** %15
%103 = call i32 @fclose(i32* %102)
br label %104
104: ; preds = %101, %3
store i32 0, i32* %4
br label %105
105: ; preds = %104, %73
%106 = load i32, i32* %4
ret i32 %106
}

LLVM IR (-O2):
%struct.sockaddr_in6 = type { i32 }
@.str = [19 x i8] c"/proc/net/if_inet6\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [51 x i8] c"%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\0A\00"
@EOF = global i64 0
@.str.3 = [24 x i8] c"%s:%s:%s:%s:%s:%s:%s:%s\00"
@.str.4 = [18 x i8] c"\09 inet6 addr: %s\0A\00"
@.str.5 = [13 x i8] c"\09 Scope: %d\0A\00"
@.str.6 = [45 x i8] c"\09Found GLOBAL addr: %s:%s:%s:%s:%s:%s:%s:%s\0A\00"
@AF_INET6 = global i32 0
define i32 @get_ipv6_address(i8* nocapture %0, %struct.sockaddr_in6* %1, i32 %2) {
%4 = alloca [40 x i8]
%5 = alloca [11 x i8]
%6 = alloca [8 x [5 x i8]]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.sockaddr_in6
%12 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %6, i64 0, i64 0, i64 0
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = bitcast i32* %10 to i8*
%19 = bitcast %struct.sockaddr_in6* %11 to i8*
%20 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %54, label %22
22: ; preds = %3
%23 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %6, i64 0, i64 1, i64 0
%24 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %6, i64 0, i64 2, i64 0
%25 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %6, i64 0, i64 3, i64 0
%26 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %6, i64 0, i64 4, i64 0
%27 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %6, i64 0, i64 5, i64 0
%28 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %6, i64 0, i64 6, i64 0
%29 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %6, i64 0, i64 7, i64 0
br label %30
30: ; preds = %44, %22
%31 = call i64 @fscanf(i32* %20, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %23, i8* %24, i8* %25, i8* %26, i8* %27, i8* %28, i8* %29, i32* %10, i32* %7, i32* %8, i32* %9, i8* %13)
%32 = load i64, i64* @EOF
%33 = icmp eq i64 %31, %32
br i1 %33, label %51, label %34
34: ; preds = %30
%35 = call i32 @strcmp(i8* %13, i8* dereferenceable(1) %0)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %34
%38 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %14, i8* %23, i8* %24, i8* %25, i8* %26, i8* %27, i8* %28, i8* %29)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%40 = load i32, i32* %8
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %8
%43 = icmp eq i32 %42, %2
br i1 %43, label %45, label %44
44: ; preds = %37, %34
br label %30
45: ; preds = %37
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* %14, i8* %23, i8* %24, i8* %25, i8* %26, i8* %27, i8* %28, i8* %29)
%47 = load i32, i32* @AF_INET6
%48 = call i32 @inet_pton(i32 %47, i8* %12, %struct.sockaddr_in6* %11)
%49 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %1, i64 0, i32 0
%50 = call i32 @memcpy(i32* %49, %struct.sockaddr_in6* %11, i32 4)
br label %51
51: ; preds = %30, %45
%52 = phi i32 [ 1, %45 ], [ 0, %30 ]
%53 = call i32 @fclose(i32* %20)
br label %54
54: ; preds = %51, %3
%55 = phi i32 [ 0, %3 ], [ %52, %51 ]
ret i32 %55
}