#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 *, unsigned int, unsigned int, unsigned int,
                          unsigned int, unsigned int, unsigned int,
                          unsigned int, unsigned int);
int /*<<< orphan*/ scanf(char *, unsigned int *);
void main() {
  unsigned a, b, c, d;
  scanf("%o", &a);
  b = a >> 4;
  c = ~(~0 << 4);
  d = b & c;
  printf("a = %o,%d\nb=%o,%d\nc = %o,%d\nd = %o,%d\n", a, a, b, b, c, c, d, d);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%r8d
mov    -0xc(%rbp),%r9d
mov    -0xc(%rbp),%r11d
mov    -0x10(%rbp),%r10d
mov    -0x10(%rbp),%eax
lea    0xe8f(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
mov    %edx,%ecx
shr    $0x4,%ecx
mov    %ecx,%eax
and    $0xf,%eax
sub    $0x8,%rsp
lea    0xeb8(%rip),%rdi
mov    %edx,%esi
mov    %ecx,%r8d
mov    $0xf,%r9d
push   %rax
push   %rax
push   $0xf
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%o\00"
@.str.1 = [39 x i8] c"a = %o,%d\0Ab=%o,%d\0Ac = %o,%d\0Ad = %o,%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = lshr i32 %6, 4
store i32 %7, i32* %2
store i32 15, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = and i32 %8, %9
store i32 %10, i32* %4
%11 = load i32, i32* %1
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = load i32, i32* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16, i32 %17, i32 %18)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%o\00"
@.str.1 = [39 x i8] c"a = %o,%d\0Ab=%o,%d\0Ac = %o,%d\0Ad = %o,%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = lshr i32 %4, 4
%6 = and i32 %5, 15
%7 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %4, i32 %5, i32 %5, i32 15, i32 15, i32 %6, i32 %6)
ret void
}