#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 */
struct ifstat {
  int dummy;
};

/* Variables and functions */
scalar_t__ irq_sstats(struct ifstat *);
scalar_t__ irq_stats(char const *, struct ifstat *);
scalar_t__ mem_stats(struct ifstat *);
scalar_t__ rxtx_stats(char const *, struct ifstat *);
scalar_t__ sys_stats(struct ifstat *);
scalar_t__ wifi_stats(char const *, struct ifstat *);
int do_stats(const char *ifname, struct ifstat *s) {
  int ret = 0;
  ret += rxtx_stats(ifname, s);
  ret += irq_stats(ifname, s);
  ret += irq_sstats(s);
  ret += sys_stats(s);
  ret += mem_stats(s);
  ret += wifi_stats(ifname, s);
  return ret;
}


x86 assembly (clang, -O0):
<do_stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <rxtx_stats@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <irq_stats@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <irq_sstats@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <sys_stats@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <mem_stats@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <wifi_stats@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_stats>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
call   1030 <rxtx_stats@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %r12,%rsi
call   1070 <irq_stats@plt>
mov    %rax,%r13
add    %r15d,%r13d
mov    %r12,%rdi
call   1080 <irq_sstats@plt>
mov    %rax,%rbx
add    %r13d,%ebx
mov    %r12,%rdi
call   1040 <sys_stats@plt>
mov    %rax,%r15
add    %ebx,%r15d
mov    %r12,%rdi
call   1050 <mem_stats@plt>
mov    %rax,%rbx
add    %r15d,%ebx
mov    %r14,%rdi
mov    %r12,%rsi
call   1060 <wifi_stats@plt>
add    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ifstat = type { i32 }
define i32 @do_stats(i8* %0, %struct.ifstat* %1) {
%3 = alloca i8*
%4 = alloca %struct.ifstat*
%5 = alloca i32
store i8* %0, i8** %3
store %struct.ifstat* %1, %struct.ifstat** %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = load %struct.ifstat*, %struct.ifstat** %4
%8 = call i64 @rxtx_stats(i8* %6, %struct.ifstat* %7)
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = add nsw i64 %10, %8
%12 = trunc i64 %11 to i32
store i32 %12, i32* %5
%13 = load i8*, i8** %3
%14 = load %struct.ifstat*, %struct.ifstat** %4
%15 = call i64 @irq_stats(i8* %13, %struct.ifstat* %14)
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = add nsw i64 %17, %15
%19 = trunc i64 %18 to i32
store i32 %19, i32* %5
%20 = load %struct.ifstat*, %struct.ifstat** %4
%21 = call i64 @irq_sstats(%struct.ifstat* %20)
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = add nsw i64 %23, %21
%25 = trunc i64 %24 to i32
store i32 %25, i32* %5
%26 = load %struct.ifstat*, %struct.ifstat** %4
%27 = call i64 @sys_stats(%struct.ifstat* %26)
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = add nsw i64 %29, %27
%31 = trunc i64 %30 to i32
store i32 %31, i32* %5
%32 = load %struct.ifstat*, %struct.ifstat** %4
%33 = call i64 @mem_stats(%struct.ifstat* %32)
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = add nsw i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %5
%38 = load i8*, i8** %3
%39 = load %struct.ifstat*, %struct.ifstat** %4
%40 = call i64 @wifi_stats(i8* %38, %struct.ifstat* %39)
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = add nsw i64 %42, %40
%44 = trunc i64 %43 to i32
store i32 %44, i32* %5
%45 = load i32, i32* %5
ret i32 %45
}

LLVM IR (-O2):
%struct.ifstat = type { i32 }
define i32 @do_stats(i8* %0, %struct.ifstat* %1) {
%3 = tail call i64 @rxtx_stats(i8* %0, %struct.ifstat* %1)
%4 = tail call i64 @irq_stats(i8* %0, %struct.ifstat* %1)
%5 = add i64 %4, %3
%6 = tail call i64 @irq_sstats(%struct.ifstat* %1)
%7 = add i64 %5, %6
%8 = tail call i64 @sys_stats(%struct.ifstat* %1)
%9 = add i64 %7, %8
%10 = tail call i64 @mem_stats(%struct.ifstat* %1)
%11 = add i64 %9, %10
%12 = tail call i64 @wifi_stats(i8* %0, %struct.ifstat* %1)
%13 = add i64 %11, %12
%14 = trunc i64 %13 to i32
ret i32 %14
}