#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 */
void *__softboundmpx_load_base_shadow_stack(int);
void *__softboundmpx_load_bound_shadow_stack(int);
int /*<<< orphan*/ __softboundmpx_store_base_shadow_stack(void *, int);
int /*<<< orphan*/ __softboundmpx_store_bound_shadow_stack(void *, int);
__attribute__((__weak__, __always___)) void
__softboundmpx_propagate_metadata_shadow_stack_from(int from_argnum,
                                                    int to_argnum) {
  void *base = __softboundmpx_load_base_shadow_stack(from_argnum);
  void *bound = __softboundmpx_load_bound_shadow_stack(from_argnum);
  __softboundmpx_store_base_shadow_stack(base, to_argnum);
  __softboundmpx_store_bound_shadow_stack(bound, to_argnum);
}


x86 assembly (clang, -O0):
<__softboundmpx_propagate_metadata_shadow_stack_from>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <__softboundmpx_load_base_shadow_stack@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <__softboundmpx_load_bound_shadow_stack@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <__softboundmpx_store_base_shadow_stack@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <__softboundmpx_store_bound_shadow_stack@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__softboundmpx_propagate_metadata_shadow_stack_from>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <__softboundmpx_load_base_shadow_stack@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   1030 <__softboundmpx_load_bound_shadow_stack@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <__softboundmpx_store_base_shadow_stack@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <__softboundmpx_store_bound_shadow_stack@plt>

LLVM IR (-O0):
define weak void @__softboundmpx_propagate_metadata_shadow_stack_from(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = call i8* @__softboundmpx_load_base_shadow_stack(i32 %7)
store i8* %8, i8** %5
%9 = load i32, i32* %3
%10 = call i8* @__softboundmpx_load_bound_shadow_stack(i32 %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %5
%12 = load i32, i32* %4
%13 = call i32 @__softboundmpx_store_base_shadow_stack(i8* %11, i32 %12)
%14 = load i8*, i8** %6
%15 = load i32, i32* %4
%16 = call i32 @__softboundmpx_store_bound_shadow_stack(i8* %14, i32 %15)
ret void
}

LLVM IR (-O2):
define weak void @__softboundmpx_propagate_metadata_shadow_stack_from(i32 %0, i32 %1) {
%3 = tail call i8* @__softboundmpx_load_base_shadow_stack(i32 %0)
%4 = tail call i8* @__softboundmpx_load_bound_shadow_stack(i32 %0)
%5 = tail call i32 @__softboundmpx_store_base_shadow_stack(i8* %3, i32 %1)
%6 = tail call i32 @__softboundmpx_store_bound_shadow_stack(i8* %4, i32 %1)
ret void
}