#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 */
typedef int uint64_t;
struct user_desc {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int clone(int (*)(void *), void *, int, void *, int /*<<< orphan*/ *,
          struct user_desc *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned long long);
int /*<<< orphan*/ stderr;
int clone_(int (*fn)(void *), void *child_stack, uint64_t flags, void *arg,
           pid_t *ptid, struct user_desc *tls, pid_t *ctid) {
  if ((flags >> 32) != 0) {
    fprintf(stderr, "Unexpected extra flags %016llx\n",
            (unsigned long long)flags);
    exit(1);
  }
  return clone(fn, child_stack, (flags & 0xFFFFFFFF), arg, ptid, tls, ctid);
}


x86 assembly (clang, -O0):
<clone_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
cmp    $0x0,%eax
je     1189 <clone_+0x59>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
movslq -0x14(%rbp),%rdx
lea    0xe86(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
and    $0xffffffff,%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <clone@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clone_>:
jmp    1030 <clone@plt>

LLVM IR (-O0):
%struct.user_desc = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"Unexpected extra flags %016llx\0A\00"
define i32 @clone_(i32 (i8*)* %0, i8* %1, i32 %2, i8* %3, i32* %4, %struct.user_desc* %5, i32* %6) {
%8 = alloca i32 (i8*)*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca %struct.user_desc*
%14 = alloca i32*
store i32 (i8*)* %0, i32 (i8*)** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i8* %3, i8** %11
store i32* %4, i32** %12
store %struct.user_desc* %5, %struct.user_desc** %13
store i32* %6, i32** %14
%15 = load i32, i32* %10
%16 = ashr i32 %15, 32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %7
%19 = load i32, i32* @stderr
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %7
%25 = load i32 (i8*)*, i32 (i8*)** %8
%26 = load i8*, i8** %9
%27 = load i32, i32* %10
%28 = and i32 %27, -1
%29 = load i8*, i8** %11
%30 = load i32*, i32** %12
%31 = load %struct.user_desc*, %struct.user_desc** %13
%32 = load i32*, i32** %14
%33 = call i32 @clone(i32 (i8*)* %25, i8* %26, i32 %28, i8* %29, i32* %30, %struct.user_desc* %31, i32* %32)
ret i32 %33
}

LLVM IR (-O2):
%struct.user_desc = type { i32 }
@stderr = global i32 0
define i32 @clone_(i32 (i8*)* %0, i8* %1, i32 %2, i8* %3, i32* %4, %struct.user_desc* %5, i32* %6) {
%8 = tail call i32 @clone(i32 (i8*)* %0, i8* %1, i32 %2, i8* %3, i32* %4, %struct.user_desc* %5, i32* %6)
ret i32 %8
}