#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 /*<<< orphan*/ bar(int, int);
int /*<<< orphan*/ baz(int, int, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ die(char *, unsigned long);
unsigned long ffz(int);
unsigned long foo();
void test(void *x) {
  unsigned long a, c;
  a = foo();
  bar(0xc000000000000000, 0x660);
  bar(0xa00000000000c000, 0x539);
  baz(2, 1, 0xa000000000008000, ({
        unsigned long b;
        b = ({
              unsigned long d;
              __asm__("" : "=r"(d) : "r"(x));
              d;
            }) +
            0x10000000000661;
        b;
      }),
      14);
  c = ffz(0x1fffffffffffffff);
  if (c < 51 || c > 61)
    die("die", c - 1);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <foo@plt>
mov    %rax,-0x10(%rbp)
xor    %edi,%edi
mov    $0x660,%esi
call   1040 <bar@plt>
mov    $0xc000,%edi
mov    $0x539,%esi
call   1040 <bar@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
movabs $0x10000000000661,%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %eax,%ecx
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x8000,%edx
mov    $0xe,%r8d
call   1030 <baz@plt>
mov    $0xffffffff,%edi
call   1070 <ffz@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x33,-0x18(%rbp)
jb     11f0 <test+0xa0>
cmpq   $0x3d,-0x18(%rbp)
jbe    1204 <test+0xb4>
mov    -0x18(%rbp),%rsi
sub    $0x1,%rsi
lea    0xe01(%rip),%rdi
call   1060 <die@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <foo@plt>
xor    %edi,%edi
mov    $0x660,%esi
call   1040 <bar@plt>
mov    $0xc000,%edi
mov    $0x539,%esi
call   1040 <bar@plt>
add    $0x661,%ecx
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x8000,%edx
mov    $0xe,%r8d
call   1030 <baz@plt>
mov    $0xffffffff,%edi
call   1070 <ffz@plt>
lea    -0x3e(%rax),%rcx
cmp    $0xfffffffffffffff4,%rcx
ja     11be <test+0x6e>
add    $0xffffffffffffffff,%rax
lea    0xe4b(%rip),%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1060 <die@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"die\00"
define void @test(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %2
%9 = call i64 (...) @foo()
store i64 %9, i64* %3
%10 = call i32 @bar(i32 0, i32 1632)
%11 = call i32 @bar(i32 49152, i32 1337)
%12 = load i8*, i8** %2
%13 = call i64 asm "", "=r,r,~{dirflag},~{fpsr},~{flags}"(i8* %12)
store i64 %13, i64* %6
%14 = load i64, i64* %6
store i64 %14, i64* %7
%15 = load i64, i64* %7
%16 = add i64 %15, 4503599627372129
store i64 %16, i64* %5
%17 = load i64, i64* %5
store i64 %17, i64* %8
%18 = load i64, i64* %8
%19 = trunc i64 %18 to i32
%20 = call i32 @baz(i32 2, i32 1, i32 32768, i32 %19, i32 14)
%21 = call i64 @ffz(i32 -1)
store i64 %21, i64* %4
%22 = load i64, i64* %4
%23 = icmp ult i64 %22, 51
br i1 %23, label %27, label %24
24: ; preds = %1
%25 = load i64, i64* %4
%26 = icmp ugt i64 %25, 61
br i1 %26, label %27, label %31
27: ; preds = %24, %1
%28 = load i64, i64* %4
%29 = sub i64 %28, 1
%30 = call i32 @die(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %29)
br label %31
31: ; preds = %27, %24
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"die\00"
define void @test(i8* %0) {
%2 = tail call i64 (...) @foo()
%3 = tail call i32 @bar(i32 0, i32 1632)
%4 = tail call i32 @bar(i32 49152, i32 1337)
%5 = tail call i64 asm "", "=r,r,~{dirflag},~{fpsr},~{flags}"(i8* %0)
%6 = trunc i64 %5 to i32
%7 = add i32 %6, 1633
%8 = tail call i32 @baz(i32 2, i32 1, i32 32768, i32 %7, i32 14)
%9 = tail call i64 @ffz(i32 -1)
%10 = add i64 %9, -62
%11 = icmp ult i64 %10, -11
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = add i64 %9, -1
%14 = tail call i32 @die(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %13)
br label %15
15: ; preds = %1, %12
ret void
}