#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 xWeakextnoinline(int);
int xWeaknoinline(int);
int xextWeak(int);
int xextnoWeak(int);
int xglobWeak(int);
int xglobnoWeak(int);
int xstatnoWeak(int);
int j(int y) {
  return xglobnoWeak(y) + xstatnoWeak(y) + xextnoWeak(y) + xglobWeak(y) +
         xextWeak(y) + xWeakextnoinline(y) + xWeaknoinline(y);
}


x86 assembly (clang, -O0):
<j>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <xglobnoWeak@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <xstatnoWeak@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <xextnoWeak@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1080 <xglobWeak@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <xextWeak@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <xWeakextnoinline@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <xWeaknoinline@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
call   1070 <xglobnoWeak@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1030 <xstatnoWeak@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %ebx,%edi
call   1090 <xextnoWeak@plt>
mov    %eax,%r14d
add    %ebp,%r14d
mov    %ebx,%edi
call   1080 <xglobWeak@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %ebx,%edi
call   1040 <xextWeak@plt>
mov    %eax,%r14d
add    %ebp,%r14d
mov    %ebx,%edi
call   1050 <xWeakextnoinline@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %ebx,%edi
call   1060 <xWeaknoinline@plt>
add    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @j(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @xglobnoWeak(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @xstatnoWeak(i32 %5)
%7 = add nsw i32 %4, %6
%8 = load i32, i32* %2
%9 = call i32 @xextnoWeak(i32 %8)
%10 = add nsw i32 %7, %9
%11 = load i32, i32* %2
%12 = call i32 @xglobWeak(i32 %11)
%13 = add nsw i32 %10, %12
%14 = load i32, i32* %2
%15 = call i32 @xextWeak(i32 %14)
%16 = add nsw i32 %13, %15
%17 = load i32, i32* %2
%18 = call i32 @xWeakextnoinline(i32 %17)
%19 = add nsw i32 %16, %18
%20 = load i32, i32* %2
%21 = call i32 @xWeaknoinline(i32 %20)
%22 = add nsw i32 %19, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @j(i32 %0) {
%2 = tail call i32 @xglobnoWeak(i32 %0)
%3 = tail call i32 @xstatnoWeak(i32 %0)
%4 = add nsw i32 %3, %2
%5 = tail call i32 @xextnoWeak(i32 %0)
%6 = add nsw i32 %4, %5
%7 = tail call i32 @xglobWeak(i32 %0)
%8 = add nsw i32 %6, %7
%9 = tail call i32 @xextWeak(i32 %0)
%10 = add nsw i32 %8, %9
%11 = tail call i32 @xWeakextnoinline(i32 %0)
%12 = add nsw i32 %10, %11
%13 = tail call i32 @xWeaknoinline(i32 %0)
%14 = add nsw i32 %12, %13
ret i32 %14
}