#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 fun_a(int);
scalar_t__ fun_b(int);
scalar_t__ fun_d(int);
scalar_t__ fun_noninline_m(int);
scalar_t__ fun_noninline_n(int);
int main() {
  int result = 100000;
  result = fun_a(result);
  result += fun_b(result);
  result += fun_noninline_m(result);
  result += fun_d(result);
  result += fun_noninline_n(result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x186a0,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <fun_a@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fun_b@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <fun_noninline_m@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <fun_d@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <fun_noninline_n@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x186a0,%edi
call   1060 <fun_a@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <fun_b@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1050 <fun_noninline_m@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1030 <fun_d@plt>
add    %eax,%ebx
mov    %ebx,%edi
call   1070 <fun_noninline_n@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 100000, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @fun_a(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i64 @fun_b(i32 %5)
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = add nsw i64 %8, %6
%10 = trunc i64 %9 to i32
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = call i64 @fun_noninline_m(i32 %11)
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = add nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = call i64 @fun_d(i32 %17)
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = add nsw i64 %20, %18
%22 = trunc i64 %21 to i32
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = call i64 @fun_noninline_n(i32 %23)
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = add nsw i64 %26, %24
%28 = trunc i64 %27 to i32
store i32 %28, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @fun_a(i32 100000)
%2 = tail call i64 @fun_b(i32 %1)
%3 = trunc i64 %2 to i32
%4 = add i32 %1, %3
%5 = tail call i64 @fun_noninline_m(i32 %4)
%6 = trunc i64 %5 to i32
%7 = add i32 %4, %6
%8 = tail call i64 @fun_d(i32 %7)
%9 = trunc i64 %8 to i32
%10 = add i32 %7, %9
%11 = tail call i64 @fun_noninline_n(i32 %10)
ret i32 0
}