#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 in6_addr {
  int dummy;
};
typedef int /*<<< orphan*/ oad;
typedef int /*<<< orphan*/ cmd;
typedef int /*<<< orphan*/ ad;

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int INET6_ADDRSTRLEN;
int atoi(char *);
int /*<<< orphan*/ execl(char *, char *, int /*<<< orphan*/ *);
char *getenv(char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, struct in6_addr *, char *,
                             int);
int /*<<< orphan*/ mask_addr(struct in6_addr *, int);
char *optarg;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
char *strrchr(char *, char);
int /*<<< orphan*/ usage(char *);
int wait_for_iface(char *, struct in6_addr *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  char *device = "eth0";
  static struct in6_addr own_addr;
  static struct in6_addr addr;
  char cmd[4096];
  ;
  char ad[INET6_ADDRSTRLEN];
  char oad[INET6_ADDRSTRLEN];
  char *mask = "48";
  char *own_mask = "64";
  char *suffix = "1";
  char *metric = "1024";
  char *script_name = NULL;
  int res;
  int bits;
  char *me;
  int c;
  if ((me = strrchr(argv[0], '/')))
    me++;
  else
    me = argv[0];
  while ((c = getopt(argc, argv, "i:n:m:s:f:")) > 0) {
    switch (c) {
    case 'i':
      device = optarg;
      break;
    case 'n':
      mask = optarg;
      break;
    case 'm':
      own_mask = optarg;
      break;
    case 's':
      suffix = optarg;
      break;
    case 'w':
      metric = optarg;
      break;
    case 'f':
      script_name = optarg;
      break;
    default:
      usage(me);
      return 0;
    }
  }
  if ((res = wait_for_iface(device, &own_addr, 0)) != 1) {
    return 1;
  }
  bits = atoi(own_mask);
  mask_addr(&own_addr, bits);
  inet_ntop(AF_INET6, &own_addr, oad, sizeof(oad));
  bits = atoi(mask);
  inet_ntop(AF_INET6, &own_addr, ad, sizeof(ad));
  mask_addr(&addr, bits);
  setenv("PREFIX_NET", ad, 1);
  setenv("MASK_NET", mask, 1);
  setenv("PREFIX_SUBNET", oad, 1);
  setenv("SUFFIX", suffix, 1);
  setenv("METRIC", metric, 1);
  if (script_name == NULL) {
    char *netname = getenv("NETNAME");
    snprintf(cmd, sizeof(cmd), "/etc/tinc/%s/tinc-slaac",
             netname ? netname : "");
  } else {
    snprintf(cmd, sizeof(cmd), "%s", script_name);
  }
  execl(cmd, cmd, NULL);
  perror("execl");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe68(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2df5(%rip),%rax
mov    (%rax),%ecx
mov    %rcx,-0x10a0(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x1028(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x1098(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x1030(%rbp)
mov    (%rax),%eax
mov    %rax,-0x1090(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1088(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x1038(%rbp)
lea    0xdfb(%rip),%rax
mov    %rax,-0x1040(%rbp)
lea    0xdf0(%rip),%rax
mov    %rax,-0x1048(%rbp)
lea    0xde5(%rip),%rax
mov    %rax,-0x1050(%rbp)
lea    0xdd9(%rip),%rax
mov    %rax,-0x1058(%rbp)
movq   $0x0,-0x1060(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x2f,%esi
call   1090 <strrchr@plt>
mov    %rax,-0x1070(%rbp)
cmp    $0x0,%rax
je     12c7 <main+0x107>
mov    -0x1070(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1070(%rbp)
jmp    12d5 <main+0x115>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x1070(%rbp)
jmp    12da <main+0x11a>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd72(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x1074(%rbp)
cmp    $0x0,%eax
jle    13d6 <main+0x216>
mov    -0x1074(%rbp),%eax
add    $0xffffff9a,%eax
mov    %eax,%ecx
mov    %rcx,-0x10a8(%rbp)
sub    $0x11,%eax
ja     13af <main+0x1ef>
mov    -0x10a8(%rbp),%rax
lea    0xcdb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2cc3(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    13d1 <main+0x211>
mov    0x2cb0(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x1040(%rbp)
jmp    13d1 <main+0x211>
mov    0x2c9a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x1048(%rbp)
jmp    13d1 <main+0x211>
mov    0x2c84(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x1050(%rbp)
jmp    13d1 <main+0x211>
mov    0x2c6e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x1058(%rbp)
jmp    13d1 <main+0x211>
mov    0x2c58(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x1060(%rbp)
jmp    13d1 <main+0x211>
mov    -0x1070(%rbp),%rdi
call   10a0 <usage@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x1078(%rbp)
jmp    15f3 <main+0x433>
jmp    12da <main+0x11a>
mov    -0x18(%rbp),%rdi
lea    0x2ca7(%rip),%rsi
xor    %edx,%edx
call   1050 <wait_for_iface@plt>
mov    %eax,-0x1064(%rbp)
cmp    $0x1,%eax
je     140d <main+0x24d>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x1078(%rbp)
jmp    15f3 <main+0x433>
mov    -0x1048(%rbp),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x1068(%rbp)
mov    -0x1068(%rbp),%esi
lea    0x2c5c(%rip),%rdi
call   1060 <mask_addr@plt>
mov    -0x1088(%rbp),%rdx
mov    -0x1090(%rbp),%rax
mov    0x2b92(%rip),%rcx
mov    (%rcx),%edi
mov    %eax,%ecx
lea    0x2c37(%rip),%rsi
call   1030 <inet_ntop@plt>
mov    -0x1040(%rbp),%rdi
call   10d0 <atoi@plt>
mov    -0x1098(%rbp),%rdx
mov    %eax,%ecx
mov    -0x10a0(%rbp),%rax
mov    %ecx,-0x1068(%rbp)
mov    0x2b59(%rip),%rcx
mov    (%rcx),%edi
mov    %eax,%ecx
lea    0x2bfe(%rip),%rsi
call   1030 <inet_ntop@plt>
mov    -0x1068(%rbp),%esi
lea    0x2bf0(%rip),%rdi
call   1060 <mask_addr@plt>
mov    -0x1098(%rbp),%rsi
lea    0xbb6(%rip),%rdi
mov    $0x1,%edx
call   1070 <setenv@plt>
mov    -0x1040(%rbp),%rsi
lea    0xba9(%rip),%rdi
mov    $0x1,%edx
call   1070 <setenv@plt>
mov    -0x1088(%rbp),%rsi
lea    0xb9a(%rip),%rdi
mov    $0x1,%edx
call   1070 <setenv@plt>
mov    -0x1050(%rbp),%rsi
lea    0xb90(%rip),%rdi
mov    $0x1,%edx
call   1070 <setenv@plt>
mov    -0x1058(%rbp),%rsi
lea    0xb7f(%rip),%rdi
mov    $0x1,%edx
call   1070 <setenv@plt>
cmpq   $0x0,-0x1060(%rbp)
jne    15a0 <main+0x3e0>
lea    0xb67(%rip),%rdi
call   1040 <getenv@plt>
mov    %rax,-0x1080(%rbp)
lea    -0x1020(%rbp),%rax
mov    %rax,-0x10b0(%rbp)
cmpq   $0x0,-0x1080(%rbp)
je     1569 <main+0x3a9>
mov    -0x1080(%rbp),%rax
mov    %rax,-0x10b8(%rbp)
jmp    157c <main+0x3bc>
lea    0xadc(%rip),%rax
mov    %rax,-0x10b8(%rbp)
jmp    157c <main+0x3bc>
mov    -0x10b0(%rbp),%rdi
mov    -0x10b8(%rbp),%rcx
mov    $0x1000,%esi
lea    0xb07(%rip),%rdx
call   1080 <snprintf@plt>
jmp    15bf <main+0x3ff>
lea    -0x1020(%rbp),%rdi
mov    -0x1060(%rbp),%rcx
mov    $0x1000,%esi
lea    0xafb(%rip),%rdx
call   1080 <snprintf@plt>
lea    -0x1020(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   10e0 <execl@plt>
lea    0xadb(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x1078(%rbp)
mov    -0x1028(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1068,%rsp
mov    %rsi,%r14
mov    %edi,%r13d
mov    %rsp,-0x88(%rbp)
mov    0x2df8(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rcx,-0x70(%rbp)
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rdx
mov    %rdx,-0x78(%rbp)
mov    %rdx,%rsp
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rax,-0x68(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rcx,%rsp
mov    (%rsi),%r15
mov    %r15,%rdi
mov    $0x2f,%esi
call   1090 <strrchr@plt>
lea    0x1(%rax),%rbx
test   %rax,%rax
cmove  %r15,%rbx
lea    0xe1a(%rip),%rdx
mov    %r13d,%edi
mov    %r14,%rsi
call   10c0 <getopt@plt>
test   %eax,%eax
jle    1314 <main+0x154>
mov    %rbx,-0x60(%rbp)
lea    0xdf5(%rip),%rcx
mov    %rcx,-0x40(%rbp)
lea    0xdec(%rip),%rcx
mov    %rcx,-0x48(%rbp)
lea    0xddc(%rip),%rcx
mov    %rcx,-0x30(%rbp)
lea    0xdce(%rip),%rcx
mov    %rcx,-0x38(%rbp)
lea    0xdbe(%rip),%rcx
mov    %rcx,-0x58(%rbp)
xor    %ecx,%ecx
mov    %rcx,-0x50(%rbp)
lea    0xd65(%rip),%rbx
mov    0x2d56(%rip),%r15
lea    0xdb1(%rip),%r12
jmp    12d2 <main+0x112>
mov    (%r15),%rax
mov    %rax,-0x58(%rbp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13d,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   10c0 <getopt@plt>
test   %eax,%eax
jle    1351 <main+0x191>
add    $0xffffff9a,%eax
cmp    $0x11,%eax
ja     1385 <main+0x1c5>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    (%r15),%rax
mov    %rax,-0x50(%rbp)
jmp    12c0 <main+0x100>
mov    (%r15),%rax
mov    %rax,-0x30(%rbp)
jmp    12c0 <main+0x100>
mov    (%r15),%rax
mov    %rax,-0x38(%rbp)
jmp    12c0 <main+0x100>
mov    (%r15),%rax
mov    %rax,-0x40(%rbp)
jmp    12c0 <main+0x100>
mov    (%r15),%rax
mov    %rax,-0x48(%rbp)
jmp    12c0 <main+0x100>
lea    0xd2d(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xd27(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xd1f(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xd19(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xd0c(%rip),%rax
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
lea    0x2d30(%rip),%rsi
mov    -0x58(%rbp),%rdi
xor    %edx,%edx
call   1050 <wait_for_iface@plt>
mov    $0x1,%ebx
cmp    $0x1,%eax
je     1392 <main+0x1d2>
mov    -0x88(%rbp),%rsp
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    -0x60(%rbp),%rdi
call   10a0 <usage@plt>
xor    %ebx,%ebx
jmp    136d <main+0x1ad>
mov    -0x30(%rbp),%rdi
call   10d0 <atoi@plt>
lea    0x2ce6(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <mask_addr@plt>
mov    0x2c25(%rip),%rbx
mov    (%rbx),%edi
mov    %r14,%rsi
mov    -0x80(%rbp),%r12
mov    %r12,%rdx
mov    -0x68(%rbp),%rcx
call   1030 <inet_ntop@plt>
mov    -0x38(%rbp),%r15
mov    %r15,%rdi
call   10d0 <atoi@plt>
mov    %eax,%r13d
mov    (%rbx),%edi
mov    %r14,%rsi
mov    -0x78(%rbp),%rbx
mov    %rbx,%rdx
mov    -0x70(%rbp),%rcx
call   1030 <inet_ntop@plt>
lea    0x2c99(%rip),%rdi
mov    %r13d,%esi
call   1060 <mask_addr@plt>
lea    0xc63(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1070 <setenv@plt>
lea    0xc5a(%rip),%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1070 <setenv@plt>
lea    0xc4f(%rip),%rdi
mov    %r12,%rsi
mov    $0x1,%edx
call   1070 <setenv@plt>
lea    0xc49(%rip),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   1070 <setenv@plt>
lea    0xc3b(%rip),%rdi
mov    -0x48(%rbp),%rsi
mov    $0x1,%edx
call   1070 <setenv@plt>
mov    -0x50(%rbp),%rcx
test   %rcx,%rcx
jne    148d <main+0x2cd>
lea    0xc24(%rip),%rdi
call   1040 <getenv@plt>
test   %rax,%rax
lea    0xbcc(%rip),%rcx
cmovne %rax,%rcx
lea    0xc12(%rip),%rdx
jmp    1494 <main+0x2d4>
lea    0xc21(%rip),%rdx
lea    -0x1090(%rbp),%rdi
mov    $0x1000,%esi
call   1080 <snprintf@plt>
xor    %ebx,%ebx
lea    -0x1090(%rbp),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   10e0 <execl@plt>
lea    0xbf9(%rip),%rdi
call   10b0 <perror@plt>
jmp    136d <main+0x1ad>

LLVM IR (-O0):
%struct.in6_addr = type { i32 }
@.str = [5 x i8] c"eth0\00"
@main.own_addr = internal global %struct.in6_addr zeroinitializer
@main.addr = internal global %struct.in6_addr zeroinitializer
@INET6_ADDRSTRLEN = global i32 0
@.str.1 = [3 x i8] c"48\00"
@.str.2 = [3 x i8] c"64\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [5 x i8] c"1024\00"
@.str.5 = [11 x i8] c"i:n:m:s:f:\00"
@optarg = global i8* null
@AF_INET6 = global i32 0
@.str.6 = [11 x i8] c"PREFIX_NET\00"
@.str.7 = [9 x i8] c"MASK_NET\00"
@.str.8 = [14 x i8] c"PREFIX_SUBNET\00"
@.str.9 = [7 x i8] c"SUFFIX\00"
@.str.10 = [7 x i8] c"METRIC\00"
@.str.11 = [8 x i8] c"NETNAME\00"
@.str.12 = [24 x i8] c"/etc/tinc/%s/tinc-slaac\00"
@.str.13 = [1 x i8] zeroinitializer
@.str.14 = [3 x i8] c"%s\00"
@.str.15 = [6 x i8] c"execl\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [4096 x i8]
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
%22 = load i32, i32* @INET6_ADDRSTRLEN
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
store i8* %24, i8** %8
%25 = alloca i8, i64 %23
store i64 %23, i64* %9
%26 = load i32, i32* @INET6_ADDRSTRLEN
%27 = zext i32 %26 to i64
%28 = alloca i8, i64 %27
store i64 %27, i64* %10
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %11
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %12
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %13
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %14
store i8* null, i8** %15
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i8* @strrchr(i8* %31, i8 signext 47)
store i8* %32, i8** %18
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %37
34: ; preds = %2
%35 = load i8*, i8** %18
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %18
br label %41
37: ; preds = %2
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
store i8* %40, i8** %18
br label %41
41: ; preds = %37, %34
br label %42
42: ; preds = %64, %41
%43 = load i32, i32* %4
%44 = load i8**, i8*** %5
%45 = call i32 @getopt(i32 %43, i8** %44, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
store i32 %45, i32* %19
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %65
47: ; preds = %42
%48 = load i32, i32* %19
switch i32 %48, label %61 [
i32 105, label %49
i32 110, label %51
i32 109, label %53
i32 115, label %55
i32 119, label %57
i32 102, label %59
]
49: ; preds = %47
%50 = load i8*, i8** @optarg
store i8* %50, i8** %6
br label %64
51: ; preds = %47
%52 = load i8*, i8** @optarg
store i8* %52, i8** %11
br label %64
53: ; preds = %47
%54 = load i8*, i8** @optarg
store i8* %54, i8** %12
br label %64
55: ; preds = %47
%56 = load i8*, i8** @optarg
store i8* %56, i8** %13
br label %64
57: ; preds = %47
%58 = load i8*, i8** @optarg
store i8* %58, i8** %14
br label %64
59: ; preds = %47
%60 = load i8*, i8** @optarg
store i8* %60, i8** %15
br label %64
61: ; preds = %47
%62 = load i8*, i8** %18
%63 = call i32 @usage(i8* %62)
store i32 0, i32* %3
store i32 1, i32* %20
br label %115
64: ; preds = %59, %57, %55, %53, %51, %49
br label %42
65: ; preds = %42
%66 = load i8*, i8** %6
%67 = call i32 @wait_for_iface(i8* %66, %struct.in6_addr* @main.own_addr, i32 0)
store i32 %67, i32* %16
%68 = icmp ne i32 %67, 1
br i1 %68, label %69, label %70
69: ; preds = %65
store i32 1, i32* %3
store i32 1, i32* %20
br label %115
70: ; preds = %65
%71 = load i8*, i8** %12
%72 = call i32 @atoi(i8* %71)
store i32 %72, i32* %17
%73 = load i32, i32* %17
%74 = call i32 @mask_addr(%struct.in6_addr* @main.own_addr, i32 %73)
%75 = load i32, i32* @AF_INET6
%76 = trunc i64 %27 to i32
%77 = call i32 @inet_ntop(i32 %75, %struct.in6_addr* @main.own_addr, i8* %28, i32 %76)
%78 = load i8*, i8** %11
%79 = call i32 @atoi(i8* %78)
store i32 %79, i32* %17
%80 = load i32, i32* @AF_INET6
%81 = trunc i64 %23 to i32
%82 = call i32 @inet_ntop(i32 %80, %struct.in6_addr* @main.own_addr, i8* %25, i32 %81)
%83 = load i32, i32* %17
%84 = call i32 @mask_addr(%struct.in6_addr* @main.addr, i32 %83)
%85 = call i32 @setenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %25, i32 1)
%86 = load i8*, i8** %11
%87 = call i32 @setenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %86, i32 1)
%88 = call i32 @setenv(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %28, i32 1)
%89 = load i8*, i8** %13
%90 = call i32 @setenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %89, i32 1)
%91 = load i8*, i8** %14
%92 = call i32 @setenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* %91, i32 1)
%93 = load i8*, i8** %15
%94 = icmp eq i8* %93, null
br i1 %94, label %95, label %106
95: ; preds = %70
%96 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
store i8* %96, i8** %21
%97 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%98 = load i8*, i8** %21
%99 = icmp ne i8* %98, null
br i1 %99, label %100, label %102
100: ; preds = %95
%101 = load i8*, i8** %21
br label %103
102: ; preds = %95
br label %103
103: ; preds = %102, %100
%104 = phi i8* [ %101, %100 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i64 0, i64 0), %102 ]
%105 = call i32 @snprintf(i8* %97, i32 4096, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i8* %104)
br label %110
106: ; preds = %70
%107 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%108 = load i8*, i8** %15
%109 = call i32 @snprintf(i8* %107, i32 4096, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8* %108)
br label %110
110: ; preds = %106, %103
%111 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%112 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%113 = call i32 @execl(i8* %111, i8* %112, i32* null)
%114 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
store i32 0, i32* %3
store i32 1, i32* %20
br label %115
115: ; preds = %110, %69, %61
%116 = load i8*, i8** %8
%117 = load i32, i32* %3
ret i32 %117
}

LLVM IR (-O2):
%struct.in6_addr = type { i32 }
@.str = [5 x i8] c"eth0\00"
@main.own_addr = internal global %struct.in6_addr zeroinitializer
@main.addr = internal global %struct.in6_addr zeroinitializer
@INET6_ADDRSTRLEN = global i32 0
@.str.1 = [3 x i8] c"48\00"
@.str.2 = [3 x i8] c"64\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [5 x i8] c"1024\00"
@.str.5 = [11 x i8] c"i:n:m:s:f:\00"
@optarg = global i8* null
@AF_INET6 = global i32 0
@.str.6 = [11 x i8] c"PREFIX_NET\00"
@.str.7 = [9 x i8] c"MASK_NET\00"
@.str.8 = [14 x i8] c"PREFIX_SUBNET\00"
@.str.9 = [7 x i8] c"SUFFIX\00"
@.str.10 = [7 x i8] c"METRIC\00"
@.str.11 = [8 x i8] c"NETNAME\00"
@.str.12 = [24 x i8] c"/etc/tinc/%s/tinc-slaac\00"
@.str.13 = [1 x i8] zeroinitializer
@.str.14 = [3 x i8] c"%s\00"
@.str.15 = [6 x i8] c"execl\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @INET6_ADDRSTRLEN
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = load i32, i32* @INET6_ADDRSTRLEN
%10 = zext i32 %9 to i64
%11 = alloca i8, i64 %10
%12 = load i8*, i8** %1
%13 = tail call i8* @strrchr(i8* dereferenceable(1) %12, i8 signext 47)
%14 = icmp eq i8* %13, null
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = select i1 %14, i8* %12, i8* %15
%17 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %50
19: ; preds = %2, %41
%20 = phi i32 [ %48, %41 ], [ %17, %2 ]
%21 = phi i8* [ %47, %41 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %2 ]
%22 = phi i8* [ %46, %41 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ]
%23 = phi i8* [ %45, %41 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %2 ]
%24 = phi i8* [ %44, %41 ], [ null, %2 ]
%25 = phi i8* [ %43, %41 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %2 ]
%26 = phi i8* [ %42, %41 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %2 ]
switch i32 %20, label %39 [
i32 105, label %27
i32 110, label %29
i32 109, label %31
i32 115, label %33
i32 119, label %35
i32 102, label %37
]
27: ; preds = %19
%28 = load i8*, i8** @optarg
br label %41
29: ; preds = %19
%30 = load i8*, i8** @optarg
br label %41
31: ; preds = %19
%32 = load i8*, i8** @optarg
br label %41
33: ; preds = %19
%34 = load i8*, i8** @optarg
br label %41
35: ; preds = %19
%36 = load i8*, i8** @optarg
br label %41
37: ; preds = %19
%38 = load i8*, i8** @optarg
br label %41
39: ; preds = %19
%40 = tail call i32 @usage(i8* %16)
br label %84
41: ; preds = %37, %35, %33, %31, %29, %27
%42 = phi i8* [ %26, %37 ], [ %26, %35 ], [ %34, %33 ], [ %26, %31 ], [ %26, %29 ], [ %26, %27 ]
%43 = phi i8* [ %25, %37 ], [ %36, %35 ], [ %25, %33 ], [ %25, %31 ], [ %25, %29 ], [ %25, %27 ]
%44 = phi i8* [ %38, %37 ], [ %24, %35 ], [ %24, %33 ], [ %24, %31 ], [ %24, %29 ], [ %24, %27 ]
%45 = phi i8* [ %23, %37 ], [ %23, %35 ], [ %23, %33 ], [ %32, %31 ], [ %23, %29 ], [ %23, %27 ]
%46 = phi i8* [ %22, %37 ], [ %22, %35 ], [ %22, %33 ], [ %22, %31 ], [ %30, %29 ], [ %22, %27 ]
%47 = phi i8* [ %21, %37 ], [ %21, %35 ], [ %21, %33 ], [ %21, %31 ], [ %21, %29 ], [ %28, %27 ]
%48 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp sgt i32 %48, 0
br i1 %49, label %19, label %50
50: ; preds = %41, %2
%51 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %2 ], [ %42, %41 ]
%52 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %2 ], [ %43, %41 ]
%53 = phi i8* [ null, %2 ], [ %44, %41 ]
%54 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %2 ], [ %45, %41 ]
%55 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %46, %41 ]
%56 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %2 ], [ %47, %41 ]
%57 = tail call i32 @wait_for_iface(i8* %56, %struct.in6_addr* @main.own_addr, i32 0)
%58 = icmp eq i32 %57, 1
br i1 %58, label %59, label %84
59: ; preds = %50
%60 = tail call i32 @atoi(i8* %54)
%61 = tail call i32 @mask_addr(%struct.in6_addr* @main.own_addr, i32 %60)
%62 = load i32, i32* @AF_INET6
%63 = call i32 @inet_ntop(i32 %62, %struct.in6_addr* @main.own_addr, i8* %11, i32 %9)
%64 = call i32 @atoi(i8* %55)
%65 = load i32, i32* @AF_INET6
%66 = call i32 @inet_ntop(i32 %65, %struct.in6_addr* @main.own_addr, i8* %8, i32 %5)
%67 = call i32 @mask_addr(%struct.in6_addr* @main.addr, i32 %64)
%68 = call i32 @setenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %8, i32 1)
%69 = call i32 @setenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* %55, i32 1)
%70 = call i32 @setenv(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %11, i32 1)
%71 = call i32 @setenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %51, i32 1)
%72 = call i32 @setenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* %52, i32 1)
%73 = icmp eq i8* %53, null
br i1 %73, label %74, label %79
74: ; preds = %59
%75 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%76 = icmp eq i8* %75, null
%77 = select i1 %76, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i64 0, i64 0), i8* %75
%78 = call i32 @snprintf(i8* %4, i32 4096, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i8* %77)
br label %81
79: ; preds = %59
%80 = call i32 @snprintf(i8* %4, i32 4096, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8* %53)
br label %81
81: ; preds = %79, %74
%82 = call i32 @execl(i8* %4, i8* %4, i32* null)
%83 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
br label %84
84: ; preds = %50, %81, %39
%85 = phi i32 [ 0, %39 ], [ 0, %81 ], [ 1, %50 ]
ret i32 %85
}