#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 uint32_t;
typedef int int32_t;

/* Variables and functions */
int INT32_MAX;
int INT32_MIN;
int UINT32_MAX;
int /*<<< orphan*/ test_int(int);
int /*<<< orphan*/ test_ptr(void *);
int /*<<< orphan*/ test_uint(int);
int main(void) {
  int32_t a;
  uint32_t b;
  void *c;
  a = 0;
  test_int(a);
  a = -1;
  test_int(a);
  a = 1;
  test_int(a);
  a = -2;
  test_int(a);
  a = 2;
  test_int(a);
  a = (INT32_MAX >> 1) - 2;
  test_int(a);
  a = (INT32_MAX >> 1) - 1;
  test_int(a);
  a = (INT32_MAX >> 1);
  test_int(a);
  a = (INT32_MIN >> 1) + 2;
  test_int(a);
  a = (INT32_MIN >> 1) + 1;
  test_int(a);
  a = (INT32_MIN >> 1);
  test_int(a);
  b = 0;
  test_uint(b);
  b = 1;
  test_uint(b);
  b = 2;
  test_uint(b);
  b = (UINT32_MAX >> 1) - 2;
  test_uint(b);
  b = (UINT32_MAX >> 1) - 1;
  test_uint(b);
  b = (UINT32_MAX >> 1);
  test_uint(b);
  c = NULL;
  test_ptr(c);
  c = (void *)&a;
  test_ptr(c);
  c = (void *)&b;
  test_ptr(c);
  c = (void *)&c;
  test_ptr(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
movl   $0xfffffffe,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <test_int@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <test_uint@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <test_uint@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <test_uint@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <test_uint@plt>
mov    0x2d8a(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <test_uint@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <test_uint@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <test_ptr@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <test_ptr@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <test_ptr@plt>
lea    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <test_ptr@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <test_int@plt>
mov    $0xffffffff,%edi
call   1040 <test_int@plt>
mov    $0x1,%edi
call   1040 <test_int@plt>
mov    $0xfffffffe,%edi
call   1040 <test_int@plt>
mov    $0x2,%edi
call   1040 <test_int@plt>
mov    0x2e6d(%rip),%rbx
mov    (%rbx),%edi
sar    %edi
add    $0xfffffffe,%edi
call   1040 <test_int@plt>
mov    (%rbx),%edi
sar    %edi
add    $0xffffffff,%edi
call   1040 <test_int@plt>
mov    (%rbx),%edi
sar    %edi
call   1040 <test_int@plt>
mov    0x2e3d(%rip),%rbx
mov    (%rbx),%edi
sar    %edi
add    $0x2,%edi
call   1040 <test_int@plt>
mov    (%rbx),%edi
sar    %edi
add    $0x1,%edi
call   1040 <test_int@plt>
mov    (%rbx),%edi
sar    %edi
mov    %edi,0x4(%rsp)
call   1040 <test_int@plt>
xor    %edi,%edi
call   1050 <test_uint@plt>
mov    $0x1,%edi
call   1050 <test_uint@plt>
mov    $0x2,%edi
call   1050 <test_uint@plt>
mov    0x2e1e(%rip),%rbx
mov    (%rbx),%edi
sar    %edi
add    $0xfffffffe,%edi
call   1050 <test_uint@plt>
mov    (%rbx),%edi
sar    %edi
add    $0xffffffff,%edi
call   1050 <test_uint@plt>
mov    (%rbx),%edi
sar    %edi
mov    %edi,(%rsp)
call   1050 <test_uint@plt>
xor    %edi,%edi
call   1030 <test_ptr@plt>
lea    0x4(%rsp),%rdi
call   1030 <test_ptr@plt>
mov    %rsp,%rdi
call   1030 <test_ptr@plt>
lea    0x8(%rsp),%rdi
mov    %rdi,0x8(%rsp)
call   1030 <test_ptr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@INT32_MAX = global i32 0
@INT32_MIN = global i32 0
@UINT32_MAX = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @test_int(i32 %5)
store i32 -1, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @test_int(i32 %7)
store i32 1, i32* %2
%9 = load i32, i32* %2
%10 = call i32 @test_int(i32 %9)
store i32 -2, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @test_int(i32 %11)
store i32 2, i32* %2
%13 = load i32, i32* %2
%14 = call i32 @test_int(i32 %13)
%15 = load i32, i32* @INT32_MAX
%16 = ashr i32 %15, 1
%17 = sub nsw i32 %16, 2
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = call i32 @test_int(i32 %18)
%20 = load i32, i32* @INT32_MAX
%21 = ashr i32 %20, 1
%22 = sub nsw i32 %21, 1
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = call i32 @test_int(i32 %23)
%25 = load i32, i32* @INT32_MAX
%26 = ashr i32 %25, 1
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = call i32 @test_int(i32 %27)
%29 = load i32, i32* @INT32_MIN
%30 = ashr i32 %29, 1
%31 = add nsw i32 %30, 2
store i32 %31, i32* %2
%32 = load i32, i32* %2
%33 = call i32 @test_int(i32 %32)
%34 = load i32, i32* @INT32_MIN
%35 = ashr i32 %34, 1
%36 = add nsw i32 %35, 1
store i32 %36, i32* %2
%37 = load i32, i32* %2
%38 = call i32 @test_int(i32 %37)
%39 = load i32, i32* @INT32_MIN
%40 = ashr i32 %39, 1
store i32 %40, i32* %2
%41 = load i32, i32* %2
%42 = call i32 @test_int(i32 %41)
store i32 0, i32* %3
%43 = load i32, i32* %3
%44 = call i32 @test_uint(i32 %43)
store i32 1, i32* %3
%45 = load i32, i32* %3
%46 = call i32 @test_uint(i32 %45)
store i32 2, i32* %3
%47 = load i32, i32* %3
%48 = call i32 @test_uint(i32 %47)
%49 = load i32, i32* @UINT32_MAX
%50 = ashr i32 %49, 1
%51 = sub nsw i32 %50, 2
store i32 %51, i32* %3
%52 = load i32, i32* %3
%53 = call i32 @test_uint(i32 %52)
%54 = load i32, i32* @UINT32_MAX
%55 = ashr i32 %54, 1
%56 = sub nsw i32 %55, 1
store i32 %56, i32* %3
%57 = load i32, i32* %3
%58 = call i32 @test_uint(i32 %57)
%59 = load i32, i32* @UINT32_MAX
%60 = ashr i32 %59, 1
store i32 %60, i32* %3
%61 = load i32, i32* %3
%62 = call i32 @test_uint(i32 %61)
store i8* null, i8** %4
%63 = load i8*, i8** %4
%64 = call i32 @test_ptr(i8* %63)
%65 = bitcast i32* %2 to i8*
store i8* %65, i8** %4
%66 = load i8*, i8** %4
%67 = call i32 @test_ptr(i8* %66)
%68 = bitcast i32* %3 to i8*
store i8* %68, i8** %4
%69 = load i8*, i8** %4
%70 = call i32 @test_ptr(i8* %69)
%71 = bitcast i8** %4 to i8*
store i8* %71, i8** %4
%72 = load i8*, i8** %4
%73 = call i32 @test_ptr(i8* %72)
ret i32 0
}

LLVM IR (-O2):
@INT32_MAX = global i32 0
@INT32_MIN = global i32 0
@UINT32_MAX = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i8** %3 to i8*
%7 = tail call i32 @test_int(i32 0)
%8 = tail call i32 @test_int(i32 -1)
%9 = tail call i32 @test_int(i32 1)
%10 = tail call i32 @test_int(i32 -2)
%11 = tail call i32 @test_int(i32 2)
%12 = load i32, i32* @INT32_MAX
%13 = ashr i32 %12, 1
%14 = add nsw i32 %13, -2
%15 = tail call i32 @test_int(i32 %14)
%16 = load i32, i32* @INT32_MAX
%17 = ashr i32 %16, 1
%18 = add nsw i32 %17, -1
%19 = tail call i32 @test_int(i32 %18)
%20 = load i32, i32* @INT32_MAX
%21 = ashr i32 %20, 1
%22 = tail call i32 @test_int(i32 %21)
%23 = load i32, i32* @INT32_MIN
%24 = ashr i32 %23, 1
%25 = add nsw i32 %24, 2
%26 = tail call i32 @test_int(i32 %25)
%27 = load i32, i32* @INT32_MIN
%28 = ashr i32 %27, 1
%29 = add nsw i32 %28, 1
%30 = tail call i32 @test_int(i32 %29)
%31 = load i32, i32* @INT32_MIN
%32 = ashr i32 %31, 1
store i32 %32, i32* %1
%33 = tail call i32 @test_int(i32 %32)
%34 = tail call i32 @test_uint(i32 0)
%35 = tail call i32 @test_uint(i32 1)
%36 = tail call i32 @test_uint(i32 2)
%37 = load i32, i32* @UINT32_MAX
%38 = ashr i32 %37, 1
%39 = add nsw i32 %38, -2
%40 = tail call i32 @test_uint(i32 %39)
%41 = load i32, i32* @UINT32_MAX
%42 = ashr i32 %41, 1
%43 = add nsw i32 %42, -1
%44 = tail call i32 @test_uint(i32 %43)
%45 = load i32, i32* @UINT32_MAX
%46 = ashr i32 %45, 1
store i32 %46, i32* %2
%47 = tail call i32 @test_uint(i32 %46)
%48 = tail call i32 @test_ptr(i8* null)
%49 = call i32 @test_ptr(i8* %4)
%50 = call i32 @test_ptr(i8* %5)
%51 = bitcast i8** %3 to i8***
store i8** %3, i8*** %51
%52 = call i32 @test_ptr(i8* %6)
ret i32 0
}