#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*/ assert(int);
int main() {
  int input;
  int input_copy;
  int output;
  output = 0;
  input_copy = input;
  int count;
  count = 32;
  while (count > 0) {
    output = output << 1;
    output = output | (input_copy & 1);
    input_copy = input_copy >> 1;
    count = count - 1;
  }
  count = 0;
  int value;
  value = 0;
  while (count < 32) {
    value = (output >> (31 - count)) & 1;
    assert(((input >> count) & 1) == value);
    count = count + 1;
  }
  count = 32;
  input_copy = output;
  output = 0;
  while (count > 0) {
    output = output << 1;
    output = output | (input_copy & 1);
    input_copy = input_copy >> 1;
    count = count - 1;
  }
  assert(output == input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x20,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    116b <main+0x5b>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <main+0x23>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x20,-0x14(%rbp)
jge    11bf <main+0xaf>
mov    -0x10(%rbp),%eax
mov    $0x1f,%ecx
sub    -0x14(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1179 <main+0x69>
movl   $0x20,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    120b <main+0xfb>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d3 <main+0xc3>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 1)
%6 = tail call i32 @assert(i32 1)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @assert(i32 1)
%10 = tail call i32 @assert(i32 1)
%11 = tail call i32 @assert(i32 1)
%12 = tail call i32 @assert(i32 1)
%13 = tail call i32 @assert(i32 1)
%14 = tail call i32 @assert(i32 1)
%15 = tail call i32 @assert(i32 1)
%16 = tail call i32 @assert(i32 1)
%17 = tail call i32 @assert(i32 1)
%18 = tail call i32 @assert(i32 1)
%19 = tail call i32 @assert(i32 1)
%20 = tail call i32 @assert(i32 1)
%21 = tail call i32 @assert(i32 1)
%22 = tail call i32 @assert(i32 1)
%23 = tail call i32 @assert(i32 1)
%24 = tail call i32 @assert(i32 1)
%25 = tail call i32 @assert(i32 1)
%26 = tail call i32 @assert(i32 1)
%27 = tail call i32 @assert(i32 1)
%28 = tail call i32 @assert(i32 1)
%29 = tail call i32 @assert(i32 1)
%30 = tail call i32 @assert(i32 1)
%31 = tail call i32 @assert(i32 1)
%32 = tail call i32 @assert(i32 1)
%33 = tail call i32 @assert(i32 0)
ret i32 0
}