#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 *__softboundcets_load_base_shadow_stack(int);
void *__softboundcets_load_bound_shadow_stack(int);
size_t __softboundcets_load_key_shadow_stack(int);
void *__softboundcets_load_lock_shadow_stack(int);
int /*<<< orphan*/ __softboundcets_metadata_store(char **, void *, void *,
                                                  size_t, void *);
__attribute__((__weak__, __always___)) void
__softboundcets_read_shadow_stack_metadata_store(char **endptr, int arg_num) {
  void *nptr_base = __softboundcets_load_base_shadow_stack(arg_num);
  void *nptr_bound = __softboundcets_load_bound_shadow_stack(arg_num);
  size_t nptr_key = __softboundcets_load_key_shadow_stack(arg_num);
  void *nptr_lock = __softboundcets_load_lock_shadow_stack(arg_num);
  __softboundcets_metadata_store(endptr, nptr_base, nptr_bound, nptr_key,
                                 nptr_lock);
}


x86 assembly (clang, -O0):
<__softboundcets_read_shadow_stack_metadata_store>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <__softboundcets_load_base_shadow_stack@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <__softboundcets_load_bound_shadow_stack@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <__softboundcets_load_key_shadow_stack@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <__softboundcets_load_lock_shadow_stack@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1030 <__softboundcets_metadata_store@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__softboundcets_read_shadow_stack_metadata_store>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
call   1040 <__softboundcets_load_base_shadow_stack@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   1060 <__softboundcets_load_bound_shadow_stack@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1070 <__softboundcets_load_key_shadow_stack@plt>
mov    %rax,%r13
mov    %ebx,%edi
call   1050 <__softboundcets_load_lock_shadow_stack@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rax,%r8
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <__softboundcets_metadata_store@plt>

LLVM IR (-O0):
define weak void @__softboundcets_read_shadow_stack_metadata_store(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
store i8** %0, i8*** %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = call i8* @__softboundcets_load_base_shadow_stack(i32 %9)
store i8* %10, i8** %5
%11 = load i32, i32* %4
%12 = call i8* @__softboundcets_load_bound_shadow_stack(i32 %11)
store i8* %12, i8** %6
%13 = load i32, i32* %4
%14 = call i64 @__softboundcets_load_key_shadow_stack(i32 %13)
store i64 %14, i64* %7
%15 = load i32, i32* %4
%16 = call i8* @__softboundcets_load_lock_shadow_stack(i32 %15)
store i8* %16, i8** %8
%17 = load i8**, i8*** %3
%18 = load i8*, i8** %5
%19 = load i8*, i8** %6
%20 = load i64, i64* %7
%21 = load i8*, i8** %8
%22 = call i32 @__softboundcets_metadata_store(i8** %17, i8* %18, i8* %19, i64 %20, i8* %21)
ret void
}

LLVM IR (-O2):
define weak void @__softboundcets_read_shadow_stack_metadata_store(i8** %0, i32 %1) {
%3 = tail call i8* @__softboundcets_load_base_shadow_stack(i32 %1)
%4 = tail call i8* @__softboundcets_load_bound_shadow_stack(i32 %1)
%5 = tail call i64 @__softboundcets_load_key_shadow_stack(i32 %1)
%6 = tail call i8* @__softboundcets_load_lock_shadow_stack(i32 %1)
%7 = tail call i32 @__softboundcets_metadata_store(i8** %0, i8* %3, i8* %4, i64 %5, i8* %6)
ret void
}