#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 /*<<< orphan*/ scanf(char *, unsigned int *);
void main() {
  unsigned m, b, c, d, e = 0;
  int i, j;
  printf("Enter the value of m:\n");
  scanf("%o", &m);
  for (i = 0; i <= 30; i = i + 2) {
    b = m >> i;
    c = ~(~0 << 1);
    d = b & c;
    e = d << (i / 2) | e;
  }
  printf("e = %o,%d", e, e);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x1e,-0x18(%rbp)
jg     11a5 <main+0x85>
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
shl    %cl,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    1154 <main+0x34>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edx
mov    %edx,%eax
and    $0x1,%eax
mov    %edx,%ecx
shr    %ecx
and    $0x2,%ecx
or     %eax,%ecx
mov    %edx,%eax
shr    $0x2,%eax
and    $0x4,%eax
or     %ecx,%eax
mov    %edx,%ecx
shr    $0x3,%ecx
and    $0x8,%ecx
or     %eax,%ecx
mov    %edx,%eax
shr    $0x4,%eax
and    $0x10,%eax
or     %ecx,%eax
mov    %edx,%ecx
shr    $0x5,%ecx
and    $0x20,%ecx
or     %eax,%ecx
mov    %edx,%eax
shr    $0x6,%eax
and    $0x40,%eax
or     %ecx,%eax
mov    %edx,%ecx
shr    $0x7,%ecx
and    $0x80,%ecx
mov    %edx,%esi
shr    $0x8,%esi
and    $0x100,%esi
or     %ecx,%esi
mov    %edx,%ecx
shr    $0x9,%ecx
and    $0x200,%ecx
or     %esi,%ecx
mov    %edx,%esi
shr    $0xa,%esi
and    $0x400,%esi
or     %ecx,%esi
mov    %edx,%ecx
shr    $0xb,%ecx
and    $0x800,%ecx
or     %esi,%ecx
mov    %edx,%esi
shr    $0xc,%esi
and    $0x1000,%esi
or     %ecx,%esi
mov    %edx,%ecx
shr    $0xd,%ecx
and    $0x2000,%ecx
or     %esi,%ecx
or     %eax,%ecx
mov    %edx,%eax
shr    $0xe,%eax
and    $0x4000,%eax
shr    $0xf,%edx
and    $0x8000,%edx
or     %eax,%edx
or     %ecx,%edx
lea    0xdf8(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter the value of m:\0A\00"
@.str.1 = [3 x i8] c"%o\00"
@.str.2 = [10 x i8] c"e = %o,%d\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
store i32 0, i32* %6
br label %10
10: ; preds = %26, %0
%11 = load i32, i32* %6
%12 = icmp sle i32 %11, 30
br i1 %12, label %13, label %29
13: ; preds = %10
%14 = load i32, i32* %1
%15 = load i32, i32* %6
%16 = lshr i32 %14, %15
store i32 %16, i32* %2
store i32 1, i32* %3
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = and i32 %17, %18
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = load i32, i32* %6
%22 = sdiv i32 %21, 2
%23 = shl i32 %20, %22
%24 = load i32, i32* %5
%25 = or i32 %23, %24
store i32 %25, i32* %5
br label %26
26: ; preds = %13
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 2
store i32 %28, i32* %6
br label %10
29: ; preds = %10
%30 = load i32, i32* %5
%31 = load i32, i32* %5
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %31)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%o\00"
@.str.2 = [10 x i8] c"e = %o,%d\00"
@str = [22 x i8] c"Enter the value of m:\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = and i32 %5, 1
%7 = lshr i32 %5, 1
%8 = and i32 %7, 2
%9 = or i32 %8, %6
%10 = lshr i32 %5, 2
%11 = and i32 %10, 4
%12 = or i32 %11, %9
%13 = lshr i32 %5, 3
%14 = and i32 %13, 8
%15 = or i32 %14, %12
%16 = lshr i32 %5, 4
%17 = and i32 %16, 16
%18 = or i32 %17, %15
%19 = lshr i32 %5, 5
%20 = and i32 %19, 32
%21 = or i32 %20, %18
%22 = lshr i32 %5, 6
%23 = and i32 %22, 64
%24 = or i32 %23, %21
%25 = lshr i32 %5, 7
%26 = and i32 %25, 128
%27 = or i32 %26, %24
%28 = lshr i32 %5, 8
%29 = and i32 %28, 256
%30 = or i32 %29, %27
%31 = lshr i32 %5, 9
%32 = and i32 %31, 512
%33 = or i32 %32, %30
%34 = lshr i32 %5, 10
%35 = and i32 %34, 1024
%36 = or i32 %35, %33
%37 = lshr i32 %5, 11
%38 = and i32 %37, 2048
%39 = or i32 %38, %36
%40 = lshr i32 %5, 12
%41 = and i32 %40, 4096
%42 = or i32 %41, %39
%43 = lshr i32 %5, 13
%44 = and i32 %43, 8192
%45 = or i32 %44, %42
%46 = lshr i32 %5, 14
%47 = and i32 %46, 16384
%48 = or i32 %47, %45
%49 = lshr i32 %5, 15
%50 = and i32 %49, 32768
%51 = or i32 %50, %48
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %51, i32 %51)
ret void
}