#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 CHAR_BIT;
int /*<<< orphan*/ printf(char *, int);
int main() {
  int v;
  int s;
  v = -1;
  s = -(v < 0);
  printf("%d\n", s);
  v = 0;
  s = -(v < 0);
  printf("%d\n", s);
  v = 1;
  s = -(v < 0);
  printf("%d\n", s);
  v = -1;
  s = -(int)((unsigned int)((int)v) >> (sizeof(int) * CHAR_BIT - 1));
  printf("%d\n", s);
  v = 0;
  s = -(int)((unsigned int)((int)v) >> (sizeof(int) * CHAR_BIT - 1));
  printf("%d\n", s);
  v = 1;
  s = -(int)((unsigned int)((int)v) >> (sizeof(int) * CHAR_BIT - 1));
  printf("%d\n", s);
  v = -1;
  s = v >> (sizeof(int) * CHAR_BIT - 1);
  printf("%d\n", s);
  v = 0;
  s = v >> (sizeof(int) * CHAR_BIT - 1);
  printf("%d\n", s);
  v = 1;
  s = v >> (sizeof(int) * CHAR_BIT - 1);
  printf("%d\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e35(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
shr    %cl,%eax
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2dff(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
shr    %cl,%eax
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2dc9(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
shr    %cl,%eax
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xdc9(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2d93(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
sar    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd99(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2d63(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
sar    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd69(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2d33(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
sar    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd39(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xee5(%rip),%rbx
mov    $0xffffffff,%ebp
mov    %rbx,%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    0x2e98(%rip),%r14
mov    (%r14),%cl
shl    $0x2,%cl
add    $0xff,%cl
shr    %cl,%ebp
neg    %ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    (%r14),%cl
shl    $0x2,%cl
add    $0xff,%cl
mov    $0x1,%esi
shr    %cl,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@CHAR_BIT = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
%6 = zext i1 %5 to i32
%7 = sub nsw i32 0, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 0, i32* %2
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
%12 = zext i1 %11 to i32
%13 = sub nsw i32 0, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
store i32 1, i32* %2
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 0
%18 = zext i1 %17 to i32
%19 = sub nsw i32 0, %18
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
store i32 -1, i32* %2
%22 = load i32, i32* %2
%23 = load i32, i32* @CHAR_BIT
%24 = sext i32 %23 to i64
%25 = mul i64 4, %24
%26 = sub i64 %25, 1
%27 = trunc i64 %26 to i32
%28 = lshr i32 %22, %27
%29 = sub nsw i32 0, %28
store i32 %29, i32* %3
%30 = load i32, i32* %3
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
store i32 0, i32* %2
%32 = load i32, i32* %2
%33 = load i32, i32* @CHAR_BIT
%34 = sext i32 %33 to i64
%35 = mul i64 4, %34
%36 = sub i64 %35, 1
%37 = trunc i64 %36 to i32
%38 = lshr i32 %32, %37
%39 = sub nsw i32 0, %38
store i32 %39, i32* %3
%40 = load i32, i32* %3
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %40)
store i32 1, i32* %2
%42 = load i32, i32* %2
%43 = load i32, i32* @CHAR_BIT
%44 = sext i32 %43 to i64
%45 = mul i64 4, %44
%46 = sub i64 %45, 1
%47 = trunc i64 %46 to i32
%48 = lshr i32 %42, %47
%49 = sub nsw i32 0, %48
store i32 %49, i32* %3
%50 = load i32, i32* %3
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %50)
store i32 -1, i32* %2
%52 = load i32, i32* %2
%53 = load i32, i32* @CHAR_BIT
%54 = sext i32 %53 to i64
%55 = mul i64 4, %54
%56 = sub i64 %55, 1
%57 = trunc i64 %56 to i32
%58 = ashr i32 %52, %57
store i32 %58, i32* %3
%59 = load i32, i32* %3
%60 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %59)
store i32 0, i32* %2
%61 = load i32, i32* %2
%62 = load i32, i32* @CHAR_BIT
%63 = sext i32 %62 to i64
%64 = mul i64 4, %63
%65 = sub i64 %64, 1
%66 = trunc i64 %65 to i32
%67 = ashr i32 %61, %66
store i32 %67, i32* %3
%68 = load i32, i32* %3
%69 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %68)
store i32 1, i32* %2
%70 = load i32, i32* %2
%71 = load i32, i32* @CHAR_BIT
%72 = sext i32 %71 to i64
%73 = mul i64 4, %72
%74 = sub i64 %73, 1
%75 = trunc i64 %74 to i32
%76 = ashr i32 %70, %75
store i32 %76, i32* %3
%77 = load i32, i32* %3
%78 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %77)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@CHAR_BIT = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = load i32, i32* @CHAR_BIT
%5 = shl i32 %4, 2
%6 = add i32 %5, -1
%7 = lshr i32 -1, %6
%8 = sub nsw i32 0, %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%11 = load i32, i32* @CHAR_BIT
%12 = shl i32 %11, 2
%13 = add i32 %12, -1
%14 = lshr i32 1, %13
%15 = sub nsw i32 0, %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -1)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%19 = load i32, i32* @CHAR_BIT
%20 = shl i32 %19, 2
%21 = add i32 %20, -1
%22 = lshr i32 1, %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}