#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*/ IPPROTO_UDP;
int LOG_CONS;
int LOG_PERROR;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ add_redirect_rule2(char *, int, char *, int,
                                      int /*<<< orphan*/, char *);
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_list_nat_rules();
int main(int argc, char **argv) {
  openlog("testipfrdrd", LOG_CONS | LOG_PERROR, LOG_USER);
  printf("List nat rules :\n");
  test_list_nat_rules();
  printf("Add redirection !\n");
  add_redirect_rule2("ep0", 12345, "1.2.3.4", 54321, IPPROTO_UDP,
                     "redirection description");
  printf("List nat rules :\n");
  test_list_nat_rules();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
mov    0x2e7a(%rip),%rax
or     (%rax),%esi
mov    0x2e79(%rip),%rax
mov    (%rax),%edx
lea    0xe88(%rip),%rdi
call   1060 <openlog@plt>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <test_list_nat_rules@plt>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%r8d
lea    0xe84(%rip),%rdi
mov    $0x3039,%esi
lea    0xe7c(%rip),%rdx
mov    $0xd431,%ecx
lea    0xe78(%rip),%r9
call   1040 <add_redirect_rule2@plt>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <test_list_nat_rules@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e88(%rip),%rax
mov    0x2e91(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
lea    0xe9d(%rip),%rdi
call   1060 <openlog@plt>
lea    0xed3(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <test_list_nat_rules@plt>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%r8d
lea    0xe71(%rip),%rdi
lea    0xe6e(%rip),%rdx
lea    0xe6f(%rip),%r9
mov    $0x3039,%esi
mov    $0xd431,%ecx
call   1040 <add_redirect_rule2@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <test_list_nat_rules@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"testipfrdrd\00"
@LOG_CONS = global i32 0
@LOG_PERROR = global i32 0
@LOG_USER = global i32 0
@.str.1 = [18 x i8] c"List nat rules :\0A\00"
@.str.2 = [19 x i8] c"Add redirection !\0A\00"
@.str.3 = [4 x i8] c"ep0\00"
@.str.4 = [8 x i8] c"1.2.3.4\00"
@IPPROTO_UDP = global i32 0
@.str.5 = [24 x i8] c"redirection description\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @LOG_CONS
%7 = load i32, i32* @LOG_PERROR
%8 = or i32 %6, %7
%9 = load i32, i32* @LOG_USER
%10 = call i32 @openlog(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (...) @test_list_nat_rules()
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @IPPROTO_UDP
%15 = call i32 @add_redirect_rule2(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 12345, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 54321, i32 %14, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (...) @test_list_nat_rules()
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"testipfrdrd\00"
@LOG_CONS = global i32 0
@LOG_PERROR = global i32 0
@LOG_USER = global i32 0
@.str.3 = [4 x i8] c"ep0\00"
@.str.4 = [8 x i8] c"1.2.3.4\00"
@IPPROTO_UDP = global i32 0
@.str.5 = [24 x i8] c"redirection description\00"
@str.6 = [18 x i8] c"Add redirection !\00"
@str.7 = [17 x i8] c"List nat rules :\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @LOG_CONS
%4 = load i32, i32* @LOG_PERROR
%5 = or i32 %4, %3
%6 = load i32, i32* @LOG_USER
%7 = tail call i32 @openlog(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
%9 = tail call i32 (...) @test_list_nat_rules()
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0))
%11 = load i32, i32* @IPPROTO_UDP
%12 = tail call i32 @add_redirect_rule2(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 12345, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 54321, i32 %11, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
%14 = tail call i32 (...) @test_list_nat_rules()
ret i32 0
}