#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ chmod(char *, int);
int /*<<< orphan*/ config_ppp_options(int /*<<< orphan*/ *, char *, char *,
                                      char *);
int /*<<< orphan*/ config_secret_options(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
char *nvram_get(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void config_primary_options() {
  FILE *fp;
  char *val;
  int idle;
  char mtu[8];
  char user[64], passwd[64];
  char *ip_up = "/etc/ppp/pppoe1-ip-up";
  char *ip_down = "/etc/ppp/pppoe1-ip-down";
  if ((fp = fopen("/etc/ppp/peers/pppoe-session1", "w")) == NULL)
    return;
  idle = atoi(nvram_get("wan_mulpppoe1_idletime"));
  if (idle > 0 && strcmp(nvram_get("wan_endis_dod"), "1") == 0) {
    fprintf(fp, "idle %d\n", idle);
    fprintf(fp, "demand\n");
  } else {
    fprintf(fp, "persist\n");
  }
  fprintf(fp, "lcp-echo-interval 20\n");
  fprintf(fp, "lcp-echo-failure 3\n");
  val = nvram_get("wan_mulpppoe1_service");
  if (strcmp(val, ""))
    fprintf(fp, "remotename %s\n", val);
  fprintf(fp, "defaultroute\n");
  fprintf(fp, "ip-up-script %s\n", ip_up);
  fprintf(fp, "ip-down-script %s\n", ip_down);
  strcpy(mtu, nvram_get("wan_mulppp_mtu"));
  if (strcmp(mtu, "") == 0)
    sprintf(mtu, "1492");
  sprintf(user, "%s", nvram_get("wan_mulpppoe1_username"));
  sprintf(passwd, "%s", nvram_get("wan_mulpppoe1_passwd"));
  config_ppp_options(fp, mtu, user, "0");
  fclose(fp);
  if ((fp = fopen(ip_up, "w")) != NULL) {
    fprintf(fp, "#!/bin/sh\n");
    fprintf(fp, "/www/cgi-bin/firewall.sh start\n");
    fprintf(fp, "/usr/sbin/ppp-nas pppoe-session1 up\n");
    fprintf(fp, "/sbin/ledcontrol -n wan -c green -s on\n");
    fclose(fp);
    chmod(ip_up, 0731);
  }
  if ((fp = fopen(ip_down, "w")) != NULL) {
    fprintf(fp, "#!/bin/sh\n");
    fprintf(fp, "/usr/sbin/ppp-nas pppoe-session1 down\n");
    fprintf(fp, "/sbin/ledcontrol -n wan -c amber -s on\n");
    fclose(fp);
    chmod(ip_down, 0731);
  }
  config_secret_options(0, user, passwd);
}


x86 assembly (clang, -O0):
<config_primary_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    0xe3e(%rip),%rax
mov    %rax,-0xa8(%rbp)
lea    0xe46(%rip),%rax
mov    %rax,-0xb0(%rbp)
lea    0xe50(%rip),%rdi
lea    0xe67(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    11fd <config_primary_options+0x4d>
jmp    1503 <config_primary_options+0x353>
lea    0xe4a(%rip),%rdi
call   10d0 <nvram_get@plt>
mov    %rax,%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    126f <config_primary_options+0xbf>
lea    0xe40(%rip),%rdi
call   10d0 <nvram_get@plt>
mov    %rax,%rdi
lea    0xe16(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    126f <config_primary_options+0xbf>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1281 <config_primary_options+0xd1>
mov    -0x8(%rbp),%rdi
lea    0xe0a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe05(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    0xe0b(%rip),%rdi
call   10d0 <nvram_get@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xde2(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12e5 <config_primary_options+0x135>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xdef(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdec(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xa8(%rbp),%rdx
lea    0xde1(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xb0(%rbp),%rdx
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    -0x1c(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    0xdd3(%rip),%rdi
call   10d0 <nvram_get@plt>
mov    -0xb8(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    -0x1c(%rbp),%rdi
lea    0xd48(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    137b <config_primary_options+0x1cb>
lea    -0x1c(%rbp),%rdi
lea    0xda9(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x60(%rbp),%rax
mov    %rax,-0xc8(%rbp)
lea    0xd98(%rip),%rdi
call   10d0 <nvram_get@plt>
mov    -0xc8(%rbp),%rdi
mov    %rax,%rdx
lea    0xd7f(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0xc0(%rbp)
lea    0xd7d(%rip),%rdi
call   10d0 <nvram_get@plt>
mov    -0xc0(%rbp),%rdi
mov    %rax,%rdx
lea    0xd4d(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x60(%rbp),%rdx
lea    0xd62(%rip),%rcx
call   1090 <config_ppp_options@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xa8(%rbp),%rdi
lea    0xc41(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     1480 <config_primary_options+0x2d0>
mov    -0x8(%rbp),%rdi
lea    0xd2a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd23(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd31(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd44(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xa8(%rbp),%rdi
mov    $0x1d9,%esi
call   1080 <chmod@plt>
mov    -0xb0(%rbp),%rdi
lea    0xbbe(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     14f1 <config_primary_options+0x341>
mov    -0x8(%rbp),%rdi
lea    0xca7(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd0d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd22(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0xb0(%rbp),%rdi
mov    $0x1d9,%esi
call   1080 <chmod@plt>
lea    -0x60(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
xor    %edi,%edi
call   1050 <config_secret_options@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_primary_options>:
push   %rbp
push   %rbx
sub    $0x98,%rsp
lea    0xe6e(%rip),%rdi
lea    0xe85(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     14bb <config_primary_options+0x30b>
mov    %rax,%rbx
lea    0xe6f(%rip),%rdi
call   10d0 <nvram_get@plt>
mov    %rax,%rdi
call   10b0 <atoi@plt>
test   %eax,%eax
jle    1212 <config_primary_options+0x62>
mov    %eax,%ebp
lea    0xe6c(%rip),%rdi
call   10d0 <nvram_get@plt>
lea    0xe45(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1220 <config_primary_options+0x70>
lea    0xe6b(%rip),%rdi
mov    $0x8,%esi
jmp    123f <config_primary_options+0x8f>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe42(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xe3a(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xe37(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xe32(%rip),%rdi
call   10d0 <nvram_get@plt>
mov    %rax,%rbp
lea    0xe0e(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12b5 <config_primary_options+0x105>
lea    0xe25(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe20(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xe15(%rip),%rsi
lea    0xd24(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe0e(%rip),%rsi
lea    0xd22(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xe09(%rip),%rdi
call   10d0 <nvram_get@plt>
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    0xd81(%rip),%rsi
mov    %rbp,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    133b <config_primary_options+0x18b>
movb   $0x0,0xc(%rsp)
movl   $0x32393431,0x8(%rsp)
32
lea    0xde0(%rip),%rdi
call   10d0 <nvram_get@plt>
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    0xddb(%rip),%rdi
call   10d0 <nvram_get@plt>
lea    0x10(%rsp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    0xdd7(%rip),%rcx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
call   1090 <config_ppp_options@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xc6a(%rip),%rdi
lea    0xcaf(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     142b <config_primary_options+0x27b>
mov    %rax,%rbx
lea    0xd9b(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
lea    0xd8d(%rip),%rdi
mov    $0x1f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xd94(%rip),%rdi
mov    $0x24,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xda0(%rip),%rdi
mov    $0x27,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xbdf(%rip),%rdi
mov    $0x1d9,%esi
call   1080 <chmod@plt>
lea    0xbe4(%rip),%rdi
lea    0xc13(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     14aa <config_primary_options+0x2fa>
mov    %rax,%rbx
lea    0xd03(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
lea    0xd62(%rip),%rdi
mov    $0x26,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xd70(%rip),%rdi
mov    $0x27,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xb76(%rip),%rdi
mov    $0x1d9,%esi
call   1080 <chmod@plt>
lea    0x50(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %edi,%edi
call   1050 <config_secret_options@plt>
add    $0x98,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"/etc/ppp/pppoe1-ip-up\00"
@.str.1 = [24 x i8] c"/etc/ppp/pppoe1-ip-down\00"
@.str.2 = [30 x i8] c"/etc/ppp/peers/pppoe-session1\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [23 x i8] c"wan_mulpppoe1_idletime\00"
@.str.5 = [14 x i8] c"wan_endis_dod\00"
@.str.6 = [2 x i8] c"1\00"
@.str.7 = [9 x i8] c"idle %d\0A\00"
@.str.8 = [8 x i8] c"demand\0A\00"
@.str.9 = [9 x i8] c"persist\0A\00"
@.str.10 = [22 x i8] c"lcp-echo-interval 20\0A\00"
@.str.11 = [20 x i8] c"lcp-echo-failure 3\0A\00"
@.str.12 = [22 x i8] c"wan_mulpppoe1_service\00"
@.str.13 = [1 x i8] zeroinitializer
@.str.14 = [15 x i8] c"remotename %s\0A\00"
@.str.15 = [14 x i8] c"defaultroute\0A\00"
@.str.16 = [17 x i8] c"ip-up-script %s\0A\00"
@.str.17 = [19 x i8] c"ip-down-script %s\0A\00"
@.str.18 = [15 x i8] c"wan_mulppp_mtu\00"
@.str.19 = [5 x i8] c"1492\00"
@.str.20 = [3 x i8] c"%s\00"
@.str.21 = [23 x i8] c"wan_mulpppoe1_username\00"
@.str.22 = [21 x i8] c"wan_mulpppoe1_passwd\00"
@.str.23 = [2 x i8] c"0\00"
@.str.24 = [11 x i8] c"#!/bin/sh\0A\00"
@.str.25 = [32 x i8] c"/www/cgi-bin/firewall.sh start\0A\00"
@.str.26 = [37 x i8] c"/usr/sbin/ppp-nas pppoe-session1 up\0A\00"
@.str.27 = [40 x i8] c"/sbin/ledcontrol -n wan -c green -s on\0A\00"
@.str.28 = [39 x i8] c"/usr/sbin/ppp-nas pppoe-session1 down\0A\00"
@.str.29 = [40 x i8] c"/sbin/ledcontrol -n wan -c amber -s on\0A\00"
define void @config_primary_options() {
%1 = alloca i32*
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [8 x i8]
%5 = alloca [64 x i8]
%6 = alloca [64 x i8]
%7 = alloca i8*
%8 = alloca i8*
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8** %8
%9 = call i32* @fopen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %9, i32** %1
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %0
br label %109
12: ; preds = %0
%13 = call i8* @nvram_get(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = call i8* @nvram_get(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load i32*, i32** %1
%23 = load i32, i32* %3
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %23)
%25 = load i32*, i32** %1
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %30
27: ; preds = %17, %12
%28 = load i32*, i32** %1
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %30
30: ; preds = %27, %21
%31 = load i32*, i32** %1
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%33 = load i32*, i32** %1
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
%35 = call i8* @nvram_get(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
store i8* %35, i8** %2
%36 = load i8*, i8** %2
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i64 0, i64 0))
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %30
%40 = load i32*, i32** %1
%41 = load i8*, i8** %2
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %39, %30
%44 = load i32*, i32** %1
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0))
%46 = load i32*, i32** %1
%47 = load i8*, i8** %7
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i8* %47)
%49 = load i32*, i32** %1
%50 = load i8*, i8** %8
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %49, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i8* %50)
%52 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%53 = call i8* @nvram_get(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
%54 = call i32 @strcpy(i8* %52, i8* %53)
%55 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %43
%59 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%60 = call i32 (i8*, i8*, ...) @sprintf(i8* %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
br label %61
61: ; preds = %58, %43
%62 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%63 = call i8* @nvram_get(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0))
%64 = call i32 (i8*, i8*, ...) @sprintf(i8* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %63)
%65 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%66 = call i8* @nvram_get(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.22, i64 0, i64 0))
%67 = call i32 (i8*, i8*, ...) @sprintf(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %66)
%68 = load i32*, i32** %1
%69 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%70 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%71 = call i32 @config_ppp_options(i32* %68, i8* %69, i8* %70, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i64 0, i64 0))
%72 = load i32*, i32** %1
%73 = call i32 @fclose(i32* %72)
%74 = load i8*, i8** %7
%75 = call i32* @fopen(i8* %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %75, i32** %1
%76 = icmp ne i32* %75, null
br i1 %76, label %77, label %90
77: ; preds = %61
%78 = load i32*, i32** %1
%79 = call i32 (i32*, i8*, ...) @fprintf(i32* %78, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0))
%80 = load i32*, i32** %1
%81 = call i32 (i32*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.25, i64 0, i64 0))
%82 = load i32*, i32** %1
%83 = call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.26, i64 0, i64 0))
%84 = load i32*, i32** %1
%85 = call i32 (i32*, i8*, ...) @fprintf(i32* %84, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.27, i64 0, i64 0))
%86 = load i32*, i32** %1
%87 = call i32 @fclose(i32* %86)
%88 = load i8*, i8** %7
%89 = call i32 @chmod(i8* %88, i32 473)
br label %90
90: ; preds = %77, %61
%91 = load i8*, i8** %8
%92 = call i32* @fopen(i8* %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %92, i32** %1
%93 = icmp ne i32* %92, null
br i1 %93, label %94, label %105
94: ; preds = %90
%95 = load i32*, i32** %1
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %95, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0))
%97 = load i32*, i32** %1
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.28, i64 0, i64 0))
%99 = load i32*, i32** %1
%100 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.29, i64 0, i64 0))
%101 = load i32*, i32** %1
%102 = call i32 @fclose(i32* %101)
%103 = load i8*, i8** %8
%104 = call i32 @chmod(i8* %103, i32 473)
br label %105
105: ; preds = %94, %90
%106 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%107 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%108 = call i32 @config_secret_options(i32 0, i8* %106, i8* %107)
br label %109
109: ; preds = %105, %11
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"/etc/ppp/pppoe1-ip-up\00"
@.str.1 = [24 x i8] c"/etc/ppp/pppoe1-ip-down\00"
@.str.2 = [30 x i8] c"/etc/ppp/peers/pppoe-session1\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [23 x i8] c"wan_mulpppoe1_idletime\00"
@.str.5 = [14 x i8] c"wan_endis_dod\00"
@.str.6 = [2 x i8] c"1\00"
@.str.7 = [9 x i8] c"idle %d\0A\00"
@.str.8 = [8 x i8] c"demand\0A\00"
@.str.9 = [9 x i8] c"persist\0A\00"
@.str.10 = [22 x i8] c"lcp-echo-interval 20\0A\00"
@.str.11 = [20 x i8] c"lcp-echo-failure 3\0A\00"
@.str.12 = [22 x i8] c"wan_mulpppoe1_service\00"
@.str.13 = [1 x i8] zeroinitializer
@.str.14 = [15 x i8] c"remotename %s\0A\00"
@.str.15 = [14 x i8] c"defaultroute\0A\00"
@.str.16 = [17 x i8] c"ip-up-script %s\0A\00"
@.str.17 = [19 x i8] c"ip-down-script %s\0A\00"
@.str.18 = [15 x i8] c"wan_mulppp_mtu\00"
@.str.19 = [5 x i8] c"1492\00"
@.str.21 = [23 x i8] c"wan_mulpppoe1_username\00"
@.str.22 = [21 x i8] c"wan_mulpppoe1_passwd\00"
@.str.23 = [2 x i8] c"0\00"
@.str.24 = [11 x i8] c"#!/bin/sh\0A\00"
@.str.25 = [32 x i8] c"/www/cgi-bin/firewall.sh start\0A\00"
@.str.26 = [37 x i8] c"/usr/sbin/ppp-nas pppoe-session1 up\0A\00"
@.str.27 = [40 x i8] c"/sbin/ledcontrol -n wan -c green -s on\0A\00"
@.str.28 = [39 x i8] c"/usr/sbin/ppp-nas pppoe-session1 down\0A\00"
@.str.29 = [40 x i8] c"/sbin/ledcontrol -n wan -c amber -s on\0A\00"
define void @config_primary_options() {
%1 = alloca [8 x i8]
%2 = alloca [64 x i8]
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %66, label %9
9: ; preds = %0
%10 = tail call i8* @nvram_get(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @atoi(i8* %10)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = tail call i8* @nvram_get(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %11)
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i64 7, i64 1, i32* %7)
br label %22
20: ; preds = %13, %9
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i64 8, i64 1, i32* %7)
br label %22
22: ; preds = %20, %17
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i64 21, i64 1, i32* %7)
%24 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i64 19, i64 1, i32* %7)
%25 = tail call i8* @nvram_get(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
%26 = tail call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %22
%29 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8* %25)
br label %30
30: ; preds = %28, %22
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i64 13, i64 1, i32* %7)
%32 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%33 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%34 = tail call i8* @nvram_get(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
%35 = call i32 @strcpy(i8* %4, i8* %34)
%36 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %30
br label %39
39: ; preds = %38, %30
%40 = call i8* @nvram_get(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0))
%41 = call i8* bitcast (i32 (i8*, i8*)* @strcpy to i8* (i8*, i8*)*)(i8* %5, i8* %40)
%42 = call i8* @nvram_get(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.22, i64 0, i64 0))
%43 = call i8* bitcast (i32 (i8*, i8*)* @strcpy to i8* (i8*, i8*)*)(i8* %6, i8* %42)
%44 = call i32 @config_ppp_options(i32* %7, i8* %4, i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i64 0, i64 0))
%45 = call i32 @fclose(i32* %7)
%46 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = icmp eq i32* %46, null
br i1 %47, label %55, label %48
48: ; preds = %39
%49 = call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0), i64 10, i64 1, i32* %46)
%50 = call i64 @fwrite(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.25, i64 0, i64 0), i64 31, i64 1, i32* %46)
%51 = call i64 @fwrite(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.26, i64 0, i64 0), i64 36, i64 1, i32* %46)
%52 = call i64 @fwrite(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.27, i64 0, i64 0), i64 39, i64 1, i32* %46)
%53 = call i32 @fclose(i32* %46)
%54 = call i32 @chmod(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 473)
br label %55
55: ; preds = %48, %39
%56 = call i32* @fopen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%57 = icmp eq i32* %56, null
br i1 %57, label %64, label %58
58: ; preds = %55
%59 = call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.24, i64 0, i64 0), i64 10, i64 1, i32* %56)
%60 = call i64 @fwrite(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.28, i64 0, i64 0), i64 38, i64 1, i32* %56)
%61 = call i64 @fwrite(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.29, i64 0, i64 0), i64 39, i64 1, i32* %56)
%62 = call i32 @fclose(i32* %56)
%63 = call i32 @chmod(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 473)
br label %64
64: ; preds = %58, %55
%65 = call i32 @config_secret_options(i32 0, i8* %5, i8* %6)
br label %66
66: ; preds = %0, %64
ret void
}