#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 */
long long __thinthin_syscall(long long, long long, ...);
long long __wasm_syscall(long long n, long long a1, long long a2, long long a3,
                         long long a4, long long a5, long long a6) {
  __thinthin_syscall(1, 1, "hi\n", 3);
  return __thinthin_syscall(n, a1, a2, a3, a4, a5, a6);
}


x86 assembly (clang, -O0):
<__wasm_syscall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    $0x1,%esi
lea    0xec0(%rip),%rdx
mov    $0x3,%ecx
mov    %rsi,%rdi
mov    $0x0,%al
call   1030 <__thinthin_syscall@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <__thinthin_syscall@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wasm_syscall>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xecc(%rip),%rdx
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x3,%ecx
xor    %eax,%eax
call   1030 <__thinthin_syscall@plt>
mov    0x40(%rsp),%rax
mov    %rax,(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1030 <__thinthin_syscall@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"hi\0A\00"
define i64 @__wasm_syscall(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
store i64 %0, i64* %8
store i64 %1, i64* %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i64 %5, i64* %13
store i64 %6, i64* %14
%15 = call i64 (i64, i64, ...) @__thinthin_syscall(i64 1, i64 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%16 = load i64, i64* %8
%17 = load i64, i64* %9
%18 = load i64, i64* %10
%19 = load i64, i64* %11
%20 = load i64, i64* %12
%21 = load i64, i64* %13
%22 = load i64, i64* %14
%23 = call i64 (i64, i64, ...) @__thinthin_syscall(i64 %16, i64 %17, i64 %18, i64 %19, i64 %20, i64 %21, i64 %22)
ret i64 %23
}

LLVM IR (-O2):
@.str = [4 x i8] c"hi\0A\00"
define i64 @__wasm_syscall(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = tail call i64 (i64, i64, ...) @__thinthin_syscall(i64 1, i64 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = tail call i64 (i64, i64, ...) @__thinthin_syscall(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6)
ret i64 %9
}