#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*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int tx_rx_stat(char *, double *, double *);
int main(int argc, char *argv[]) {
  char eth_name[100];
  strcpy(eth_name, "eth0");
  if (argc > 1)
    strcpy(eth_name, argv[1]);
  printf("eth name: %s\n", eth_name);
  double recv = 0, send = 0;
  int ret = tx_rx_stat(eth_name, &recv, &send);
  printf("ret: %d, recv = %f, send = %f\n", ret, recv, send);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1174 <main+0x44>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
lea    -0x80(%rbp),%rdi
lea    -0x88(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1050 <tx_rx_stat@plt>
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%esi
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm1
ff
lea    0xe3d(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xebe(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
cmp    $0x2,%ebp
jl     115f <main+0x2f>
mov    0x8(%rbx),%rsi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
lea    0xe9f(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <tx_rx_stat@plt>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
lea    0xe6b(%rip),%rdi
mov    %eax,%esi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"eth0\00"
@.str.1 = [14 x i8] c"eth name: %s\0A\00"
@.str.2 = [31 x i8] c"ret: %d, recv = %f, send = %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca double
%8 = alloca double
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 1
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strcpy(i8* %15, i8* %18)
br label %20
20: ; preds = %14, %2
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %21)
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%24 = call i32 @tx_rx_stat(i8* %23, double* %7, double* %8)
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = load double, double* %7
%27 = load double, double* %8
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %25, double %26, double %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"eth0\00"
@.str.1 = [14 x i8] c"eth name: %s\0A\00"
@.str.2 = [31 x i8] c"ret: %d, recv = %f, send = %f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca double
%5 = alloca double
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strcpy(i8* %6, i8* %11)
br label %13
13: ; preds = %9, %2
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%15 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%16 = bitcast double* %5 to i8*
store double 0.000000e+00, double* %5
%17 = call i32 @tx_rx_stat(i8* %6, double* %4, double* %5)
%18 = load double, double* %4
%19 = load double, double* %5
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %17, double %18, double %19)
ret i32 0
}