#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 rand();
unsigned long long get_size(void) {
  unsigned long long val;
  switch (rand() % 5) {
  case 0:
    val = ((long long)rand() << 32) | rand();
    break;
  case 1:
    val = rand();
    break;
  case 2:
    val = rand() & ~0xffff;
    break;
  case 3:
    val = 0xffffffff00000000ULL | rand();
    break;
  default:
    val = 0;
  }
  return val;
}


x86 assembly (clang, -O0):
<get_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rdx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11d5 <get_size+0xc5>
mov    -0x10(%rbp),%rax
lea    0xea9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <rand@plt>
cltq
shl    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    11dd <get_size+0xcd>
mov    $0x0,%al
call   1030 <rand@plt>
cltq
mov    %rax,-0x8(%rbp)
jmp    11dd <get_size+0xcd>
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xffff0000,%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    11dd <get_size+0xcd>
mov    $0x0,%al
call   1030 <rand@plt>
cltq
movabs $0xffffffff00000000,%rcx
ff ff ff
or     %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    11dd <get_size+0xcd>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_size>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cmp    $0x3,%eax
ja     119b <get_size+0x8b>
lea    0xebc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%r14d
shl    $0x20,%r14
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rbx
or     %r14,%rbx
jmp    119b <get_size+0x8b>
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rbx
jmp    119b <get_size+0x8b>
xor    %eax,%eax
call   1030 <rand@plt>
and    $0xffff0000,%eax
movslq %eax,%rbx
jmp    119b <get_size+0x8b>
xor    %eax,%eax
call   1030 <rand@plt>
movabs $0xffffffff00000000,%rbx
ff ff ff
or     %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @get_size() {
%1 = alloca i64
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 5
switch i32 %3, label %22 [
i32 0, label %4
i32 1, label %11
i32 2, label %14
i32 3, label %18
]
4: ; preds = %0
%5 = call i32 (...) @rand()
%6 = sext i32 %5 to i64
%7 = shl i64 %6, 32
%8 = call i32 (...) @rand()
%9 = sext i32 %8 to i64
%10 = or i64 %7, %9
store i64 %10, i64* %1
br label %23
11: ; preds = %0
%12 = call i32 (...) @rand()
%13 = sext i32 %12 to i64
store i64 %13, i64* %1
br label %23
14: ; preds = %0
%15 = call i32 (...) @rand()
%16 = and i32 %15, -65536
%17 = sext i32 %16 to i64
store i64 %17, i64* %1
br label %23
18: ; preds = %0
%19 = call i32 (...) @rand()
%20 = sext i32 %19 to i64
%21 = or i64 -4294967296, %20
store i64 %21, i64* %1
br label %23
22: ; preds = %0
store i64 0, i64* %1
br label %23
23: ; preds = %22, %18, %14, %11, %4
%24 = load i64, i64* %1
ret i64 %24
}

LLVM IR (-O2):
define i64 @get_size() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 5
switch i32 %2, label %21 [
i32 0, label %3
i32 1, label %10
i32 2, label %13
i32 3, label %17
]
3: ; preds = %0
%4 = tail call i32 (...) @rand()
%5 = zext i32 %4 to i64
%6 = shl nuw i64 %5, 32
%7 = tail call i32 (...) @rand()
%8 = sext i32 %7 to i64
%9 = or i64 %6, %8
br label %21
10: ; preds = %0
%11 = tail call i32 (...) @rand()
%12 = sext i32 %11 to i64
br label %21
13: ; preds = %0
%14 = tail call i32 (...) @rand()
%15 = and i32 %14, -65536
%16 = sext i32 %15 to i64
br label %21
17: ; preds = %0
%18 = tail call i32 (...) @rand()
%19 = zext i32 %18 to i64
%20 = or i64 %19, -4294967296
br label %21
21: ; preds = %0, %17, %13, %10, %3
%22 = phi i64 [ %20, %17 ], [ %16, %13 ], [ %12, %10 ], [ %9, %3 ], [ 0, %0 ]
ret i64 %22
}