#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*/ printf(char *);
int is_shifting_signed(long arg) {
  long res = arg >> 4;
  if (res == -0x7F7E80CL) {
    return 1;
  }
  res |= (~0L) << (32 - 4);
  if (res == -0x7F7E80CL) {
    return 0;
  }
  printf("Right shift isn't acting as I expect it to.\n");
  printf("I fear the JPEG software will not work at all.\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<is_shifting_signed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x4,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0xfffffffff80817f4,-0x18(%rbp)
f8
jne    1142 <is_shifting_signed+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1189 <is_shifting_signed+0x79>
mov    -0x18(%rbp),%rax
or     $0xfffffffff0000000,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0xfffffffff80817f4,-0x18(%rbp)
f8
jne    116a <is_shifting_signed+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    1189 <is_shifting_signed+0x79>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_shifting_signed>:
push   %rbx
mov    %rdi,%rax
and    $0xfffffffffffffff0,%rax
mov    $0x1,%ebx
cmp    $0xffffffff80817f40,%rax
je     114a <is_shifting_signed+0x3a>
and    $0xfffffff0,%edi
xor    %ebx,%ebx
cmp    $0x80817f40,%edi
je     114a <is_shifting_signed+0x3a>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Right shift isn't acting as I expect it to.\0A\00"
@.str.1 = [49 x i8] c"I fear the JPEG software will not work at all.\0A\0A\00"
define i32 @is_shifting_signed(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = ashr i64 %5, 4
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp eq i64 %7, -133687308
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 1, i32* %2
br label %19
10: ; preds = %1
%11 = load i64, i64* %4
%12 = or i64 %11, -268435456
store i64 %12, i64* %4
%13 = load i64, i64* %4
%14 = icmp eq i64 %13, -133687308
br i1 %14, label %15, label %16
15: ; preds = %10
store i32 0, i32* %2
br label %19
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %19
19: ; preds = %16, %15, %9
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@str = [44 x i8] c"Right shift isn't acting as I expect it to.\00"
@str.2 = [48 x i8] c"I fear the JPEG software will not work at all.\0A\00"
define i32 @is_shifting_signed(i64 %0) {
%2 = and i64 %0, -16
%3 = icmp eq i64 %2, -2138996928
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = and i64 %0, 4294967280
%6 = icmp eq i64 %5, 2155970368
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.2, i64 0, i64 0))
br label %10
10: ; preds = %4, %1, %7
%11 = phi i32 [ 0, %7 ], [ 1, %1 ], [ 0, %4 ]
ret i32 %11
}