#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*/ foo(int);
int /*<<< orphan*/ put_unsigned(unsigned int);
int /*<<< orphan*/ putchar(char);
main() {
  int i, sh;
  unsigned u;
  unsigned failed = 0;
  i = 1;
  u = 1;
  for (sh = 0; sh < 32; ++sh) {
    put_unsigned(1 << sh);
    putchar('\n');
    i += i;
  }
  putchar('\n');
  i = ~0;
  for (sh = 31; sh >= 0; --sh) {
    put_unsigned(((int)0x80000000) >> sh);
    putchar('\n');
    i += i;
  }
  putchar('\n');
  u = 1;
  for (sh = 31; sh >= 0; --sh) {
    put_unsigned(((unsigned)0x80000000) >> sh);
    putchar('\n');
    u += u;
  }
  putchar('\n');
  put_unsigned(failed);
  putchar('\n');
  foo(0x1729);
  foo(-1729);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1195 <main+0x65>
mov    -0xc(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
call   1050 <put_unsigned@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115b <main+0x2b>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0xffffffff,-0x8(%rbp)
movl   $0x1f,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11e7 <main+0xb7>
mov    -0xc(%rbp),%ecx
mov    $0x80000000,%edi
sar    %cl,%edi
call   1050 <put_unsigned@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11ad <main+0x7d>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x1,-0x10(%rbp)
movl   $0x1f,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1239 <main+0x109>
mov    -0xc(%rbp),%ecx
mov    $0x80000000,%edi
shr    %cl,%edi
call   1050 <put_unsigned@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11ff <main+0xcf>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%edi
call   1050 <put_unsigned@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1729,%edi
call   1040 <foo@plt>
mov    $0xfffff93f,%edi
call   1040 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%edi
mov    %ebx,%ecx
shl    %cl,%edi
call   1050 <put_unsigned@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    $0x20,%ebx
jne    1140 <main+0x10>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1f,%ebx
nop
mov    $0x80000000,%edi
mov    %ebx,%ecx
sar    %cl,%edi
call   1050 <put_unsigned@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jb     1170 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1f,%ebx
nopl   0x0(%rax)
mov    $0x80000000,%edi
mov    %ebx,%ecx
shr    %cl,%edi
call   1050 <put_unsigned@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jb     11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1050 <put_unsigned@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1729,%edi
call   1040 <foo@plt>
mov    $0xfffff93f,%edi
call   1040 <foo@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 1, i32* %2
store i32 1, i32* %4
store i32 0, i32* %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 32
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
%11 = shl i32 1, %10
%12 = call i32 @put_unsigned(i32 %11)
%13 = call i32 @putchar(i8 signext 10)
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = add nsw i32 %15, %14
store i32 %16, i32* %2
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
%21 = call i32 @putchar(i8 signext 10)
store i32 -1, i32* %2
store i32 31, i32* %3
br label %22
22: ; preds = %33, %20
%23 = load i32, i32* %3
%24 = icmp sge i32 %23, 0
br i1 %24, label %25, label %36
25: ; preds = %22
%26 = load i32, i32* %3
%27 = ashr i32 -2147483648, %26
%28 = call i32 @put_unsigned(i32 %27)
%29 = call i32 @putchar(i8 signext 10)
%30 = load i32, i32* %2
%31 = load i32, i32* %2
%32 = add nsw i32 %31, %30
store i32 %32, i32* %2
br label %33
33: ; preds = %25
%34 = load i32, i32* %3
%35 = add nsw i32 %34, -1
store i32 %35, i32* %3
br label %22
36: ; preds = %22
%37 = call i32 @putchar(i8 signext 10)
store i32 1, i32* %4
store i32 31, i32* %3
br label %38
38: ; preds = %49, %36
%39 = load i32, i32* %3
%40 = icmp sge i32 %39, 0
br i1 %40, label %41, label %52
41: ; preds = %38
%42 = load i32, i32* %3
%43 = lshr i32 -2147483648, %42
%44 = call i32 @put_unsigned(i32 %43)
%45 = call i32 @putchar(i8 signext 10)
%46 = load i32, i32* %4
%47 = load i32, i32* %4
%48 = add i32 %47, %46
store i32 %48, i32* %4
br label %49
49: ; preds = %41
%50 = load i32, i32* %3
%51 = add nsw i32 %50, -1
store i32 %51, i32* %3
br label %38
52: ; preds = %38
%53 = call i32 @putchar(i8 signext 10)
%54 = load i32, i32* %5
%55 = call i32 @put_unsigned(i32 %54)
%56 = call i32 @putchar(i8 signext 10)
%57 = call i32 @foo(i32 5929)
%58 = call i32 @foo(i32 -1729)
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = shl nuw i32 1, %2
%4 = tail call i32 @put_unsigned(i32 %3)
%5 = tail call i32 @putchar(i8 signext 10)
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 32
br i1 %7, label %8, label %1
8: ; preds = %1
%9 = tail call i32 @putchar(i8 signext 10)
br label %10
10: ; preds = %8, %10
%11 = phi i32 [ 31, %8 ], [ %15, %10 ]
%12 = ashr i32 -2147483648, %11
%13 = tail call i32 @put_unsigned(i32 %12)
%14 = tail call i32 @putchar(i8 signext 10)
%15 = add nsw i32 %11, -1
%16 = icmp eq i32 %11, 0
br i1 %16, label %17, label %10
17: ; preds = %10
%18 = tail call i32 @putchar(i8 signext 10)
br label %19
19: ; preds = %17, %19
%20 = phi i32 [ 31, %17 ], [ %24, %19 ]
%21 = lshr i32 -2147483648, %20
%22 = tail call i32 @put_unsigned(i32 %21)
%23 = tail call i32 @putchar(i8 signext 10)
%24 = add nsw i32 %20, -1
%25 = icmp eq i32 %20, 0
br i1 %25, label %26, label %19
26: ; preds = %19
%27 = tail call i32 @putchar(i8 signext 10)
%28 = tail call i32 @put_unsigned(i32 0)
%29 = tail call i32 @putchar(i8 signext 10)
%30 = tail call i32 @foo(i32 5929)
%31 = tail call i32 @foo(i32 -1729)
ret i32 0
}