#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*/ test_value(long);
int main(void) {
  long i, j;
  union {
    long value;
    unsigned char bytes[sizeof(long)];
  } u;
  long value = (long)-5;
  for (i = 0; i < 12; i++) {
    test_value(value);
    value++;
  }
  for (i = 0; i < 8 * sizeof(long); i++)
    test_value(((long)1) << i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0xfffffffffffffffb,-0x28(%rbp)
ff
movq   $0x0,-0x10(%rbp)
cmpq   $0xc,-0x10(%rbp)
jge    1160 <main+0x50>
mov    -0x28(%rbp),%rdi
call   1030 <test_value@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112f <main+0x1f>
movq   $0x0,-0x10(%rbp)
cmpq   $0x40,-0x10(%rbp)
jae    1195 <main+0x85>
mov    -0x10(%rbp),%rcx
mov    $0x1,%edi
shl    %cl,%rdi
call   1030 <test_value@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1168 <main+0x58>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xfffffffffffffffb,%rdi
call   1030 <test_value@plt>
mov    $0xfffffffffffffffc,%rdi
call   1030 <test_value@plt>
mov    $0xfffffffffffffffd,%rdi
call   1030 <test_value@plt>
mov    $0xfffffffffffffffe,%rdi
call   1030 <test_value@plt>
mov    $0xffffffffffffffff,%rdi
call   1030 <test_value@plt>
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <test_value@plt>
mov    $0x1,%edi
call   1030 <test_value@plt>
mov    $0x2,%edi
call   1030 <test_value@plt>
mov    $0x3,%edi
call   1030 <test_value@plt>
mov    $0x4,%edi
call   1030 <test_value@plt>
mov    $0x5,%edi
call   1030 <test_value@plt>
mov    $0x6,%edi
call   1030 <test_value@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %ebx,%ecx
shl    %cl,%rdi
call   1030 <test_value@plt>
add    $0x1,%rbx
cmp    $0x40,%rbx
jne    11a0 <main+0x90>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%union.anon = type { i64 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca %union.anon
%5 = alloca i64
store i32 0, i32* %1
store i64 -5, i64* %5
store i64 0, i64* %2
br label %6
6: ; preds = %14, %0
%7 = load i64, i64* %2
%8 = icmp slt i64 %7, 12
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i64, i64* %5
%11 = call i32 @test_value(i64 %10)
%12 = load i64, i64* %5
%13 = add nsw i64 %12, 1
store i64 %13, i64* %5
br label %14
14: ; preds = %9
%15 = load i64, i64* %2
%16 = add nsw i64 %15, 1
store i64 %16, i64* %2
br label %6
17: ; preds = %6
store i64 0, i64* %2
br label %18
18: ; preds = %25, %17
%19 = load i64, i64* %2
%20 = icmp ult i64 %19, 64
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i64, i64* %2
%23 = shl i64 1, %22
%24 = call i32 @test_value(i64 %23)
br label %25
25: ; preds = %21
%26 = load i64, i64* %2
%27 = add nsw i64 %26, 1
store i64 %27, i64* %2
br label %18
28: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_value(i64 -5)
%2 = tail call i32 @test_value(i64 -4)
%3 = tail call i32 @test_value(i64 -3)
%4 = tail call i32 @test_value(i64 -2)
%5 = tail call i32 @test_value(i64 -1)
%6 = tail call i32 @test_value(i64 0)
%7 = tail call i32 @test_value(i64 1)
%8 = tail call i32 @test_value(i64 2)
%9 = tail call i32 @test_value(i64 3)
%10 = tail call i32 @test_value(i64 4)
%11 = tail call i32 @test_value(i64 5)
%12 = tail call i32 @test_value(i64 6)
br label %13
13: ; preds = %0, %13
%14 = phi i64 [ %17, %13 ], [ 0, %0 ]
%15 = shl nuw i64 1, %14
%16 = tail call i32 @test_value(i64 %15)
%17 = add nuw nsw i64 %14, 1
%18 = icmp eq i64 %17, 64
br i1 %18, label %19, label %13
19: ; preds = %13
ret i32 0
}