#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*/ memcpy(char *, char *, int);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
void create_file_path(char *ifname, int ifname_len, char *path) {
  char str1[] = "/sys/class/net/";
  strncat(str1, ifname, ifname_len);
  memcpy(path, str1, strlen(str1));
  char str2[] = "/statistics/tx_packets";
  strncat(path, str2, strlen(str2));
}


x86 assembly (clang, -O0):
<create_file_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0xeb6(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <strncat@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    0xe78(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe73(%rip),%eax
mov    %eax,-0x40(%rbp)
mov    0xe6d(%rip),%ax
mov    %ax,-0x3c(%rbp)
mov    0xe65(%rip),%al
mov    %al,-0x3a(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
call   1040 <strncat@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_file_path>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r14
mov    %esi,%edx
mov    %rdi,%rsi
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strncat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <memcpy@plt>
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x7374656b636170,%rax
mov    %rax,0xf(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <strncat@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.create_file_path.str1 = [16 x i8] c"/sys/class/net/\00"
@__const.create_file_path.str2 = [23 x i8] c"/statistics/tx_packets\00"
define void @create_file_path(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [16 x i8]
%8 = alloca [23 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = bitcast [16 x i8]* %7 to i8*
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = call i32 @strncat(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %6
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = call i32 @memcpy(i8* %14, i8* %15, i32 %17)
%19 = bitcast [23 x i8]* %8 to i8*
%20 = load i8*, i8** %6
%21 = getelementptr inbounds [23 x i8], [23 x i8]* %8, i64 0, i64 0
%22 = getelementptr inbounds [23 x i8], [23 x i8]* %8, i64 0, i64 0
%23 = call i32 @strlen(i8* %22)
%24 = call i32 @strncat(i8* %20, i8* %21, i32 %23)
ret void
}

LLVM IR (-O2):
@__const.create_file_path.str1 = [16 x i8] c"/sys/class/net/\00"
@__const.create_file_path.str2 = [23 x i8] c"/statistics/tx_packets\00"
define void @create_file_path(i8* %0, i32 %1, i8* %2) {
%4 = alloca [16 x i8]
%5 = alloca [23 x i8]
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%7 = call i32 @strncat(i8* %6, i8* %0, i32 %1)
%8 = call i32 @strlen(i8* %6)
%9 = call i32 @memcpy(i8* %2, i8* %6, i32 %8)
%10 = getelementptr inbounds [23 x i8], [23 x i8]* %5, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @strncat(i8* %2, i8* %10, i32 %11)
ret void
}