#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 */

/* Variables and functions */
int /*<<< orphan*/ WRITE_DHCPC_FILE(int, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int set_dhcp_NATLB_chain(int fh, char *nat_pre_name, char *nat_post_name) {
  char buff[64];
  snprintf(buff, 64, "\tiptables -t nat -F %s\n", nat_pre_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -D PREROUTING -j %s\n", nat_pre_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -X %s\n", nat_pre_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -F %s\n", nat_post_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -D POSTROUTING -j %s\n", nat_post_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -X %s\n", nat_post_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -N %s\n", nat_pre_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -A PREROUTING -j %s\n", nat_pre_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -N %s\n", nat_post_name);
  WRITE_DHCPC_FILE(fh, buff);
  snprintf(buff, 64, "\tiptables -t nat -A POSTROUTING -j %s\n", nat_post_name);
  WRITE_DHCPC_FILE(fh, buff);
  return 0;
}


x86 assembly (clang, -O0):
<set_dhcp_NATLB_chain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x40,%esi
lea    0xeb9(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x40,%esi
lea    0xeac(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x40,%esi
lea    0xead(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x40,%esi
lea    0xe4a(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x40,%esi
lea    0xe7b(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x40,%esi
lea    0xe3e(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x40,%esi
lea    0xe58(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x40,%esi
lea    0xe4b(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x40,%esi
lea    0xe0e(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x40,%esi
lea    0xe27(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_dhcp_NATLB_chain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r14
mov    %rsi,%r12
mov    %edi,%ebx
lea    0xec3(%rip),%r13
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x40,%esi
mov    %r13,%rdx
mov    %r12,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    0xeb4(%rip),%rdx
mov    %r15,%rdi
mov    $0x40,%esi
mov    %r12,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    0xeb9(%rip),%rbp
mov    %r15,%rdi
mov    $0x40,%esi
mov    %rbp,%rdx
mov    %r12,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
mov    %r15,%rdi
mov    $0x40,%esi
mov    %r13,%rdx
mov    %r14,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    0xe90(%rip),%rdx
mov    %r15,%rdi
mov    $0x40,%esi
mov    %r14,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
mov    %r15,%rdi
mov    $0x40,%esi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    0xe79(%rip),%rbp
mov    %r15,%rdi
mov    $0x40,%esi
mov    %rbp,%rdx
mov    %r12,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    0xe6d(%rip),%rdx
mov    %r15,%rdi
mov    $0x40,%esi
mov    %r12,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
mov    %r15,%rdi
mov    $0x40,%esi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
lea    0xe55(%rip),%rdx
mov    %r15,%rdi
mov    $0x40,%esi
mov    %r14,%rcx
call   1030 <snprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <WRITE_DHCPC_FILE@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"\09iptables -t nat -F %s\0A\00"
@.str.1 = [38 x i8] c"\09iptables -t nat -D PREROUTING -j %s\0A\00"
@.str.2 = [24 x i8] c"\09iptables -t nat -X %s\0A\00"
@.str.3 = [39 x i8] c"\09iptables -t nat -D POSTROUTING -j %s\0A\00"
@.str.4 = [24 x i8] c"\09iptables -t nat -N %s\0A\00"
@.str.5 = [38 x i8] c"\09iptables -t nat -A PREROUTING -j %s\0A\00"
@.str.6 = [39 x i8] c"\09iptables -t nat -A POSTROUTING -j %s\0A\00"
define i32 @set_dhcp_NATLB_chain(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [64 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %5
%10 = call i32 @snprintf(i8* %8, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* %4
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%13 = call i32 @WRITE_DHCPC_FILE(i32 %11, i8* %12)
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%15 = load i8*, i8** %5
%16 = call i32 @snprintf(i8* %14, i32 64, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %4
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%19 = call i32 @WRITE_DHCPC_FILE(i32 %17, i8* %18)
%20 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%21 = load i8*, i8** %5
%22 = call i32 @snprintf(i8* %20, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = load i32, i32* %4
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%25 = call i32 @WRITE_DHCPC_FILE(i32 %23, i8* %24)
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%27 = load i8*, i8** %6
%28 = call i32 @snprintf(i8* %26, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %4
%30 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%31 = call i32 @WRITE_DHCPC_FILE(i32 %29, i8* %30)
%32 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%33 = load i8*, i8** %6
%34 = call i32 @snprintf(i8* %32, i32 64, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = load i32, i32* %4
%36 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%37 = call i32 @WRITE_DHCPC_FILE(i32 %35, i8* %36)
%38 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%39 = load i8*, i8** %6
%40 = call i32 @snprintf(i8* %38, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %39)
%41 = load i32, i32* %4
%42 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%43 = call i32 @WRITE_DHCPC_FILE(i32 %41, i8* %42)
%44 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%45 = load i8*, i8** %5
%46 = call i32 @snprintf(i8* %44, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = load i32, i32* %4
%48 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%49 = call i32 @WRITE_DHCPC_FILE(i32 %47, i8* %48)
%50 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%51 = load i8*, i8** %5
%52 = call i32 @snprintf(i8* %50, i32 64, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %51)
%53 = load i32, i32* %4
%54 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%55 = call i32 @WRITE_DHCPC_FILE(i32 %53, i8* %54)
%56 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%57 = load i8*, i8** %6
%58 = call i32 @snprintf(i8* %56, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %57)
%59 = load i32, i32* %4
%60 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%61 = call i32 @WRITE_DHCPC_FILE(i32 %59, i8* %60)
%62 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%63 = load i8*, i8** %6
%64 = call i32 @snprintf(i8* %62, i32 64, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* %63)
%65 = load i32, i32* %4
%66 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%67 = call i32 @WRITE_DHCPC_FILE(i32 %65, i8* %66)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"\09iptables -t nat -F %s\0A\00"
@.str.1 = [38 x i8] c"\09iptables -t nat -D PREROUTING -j %s\0A\00"
@.str.2 = [24 x i8] c"\09iptables -t nat -X %s\0A\00"
@.str.3 = [39 x i8] c"\09iptables -t nat -D POSTROUTING -j %s\0A\00"
@.str.4 = [24 x i8] c"\09iptables -t nat -N %s\0A\00"
@.str.5 = [38 x i8] c"\09iptables -t nat -A PREROUTING -j %s\0A\00"
@.str.6 = [39 x i8] c"\09iptables -t nat -A POSTROUTING -j %s\0A\00"
define i32 @set_dhcp_NATLB_chain(i32 %0, i8* %1, i8* %2) {
%4 = alloca [64 x i8]
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%8 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%9 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%10 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%11 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%12 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %2)
%13 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%14 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%15 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%16 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%17 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%18 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%19 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%20 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%21 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%22 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%23 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
%24 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i8* %2)
%25 = call i32 @WRITE_DHCPC_FILE(i32 %0, i8* %5)
ret i32 0
}