#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 *, char);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char c;
  scanf("%hhd", &c);
  for (unsigned i = 0; i < 8; ++i) {
    printf("%d", (c >> (7 - i)) & 1);
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jae    118e <main+0x5e>
movsbl -0x5(%rbp),%eax
mov    $0x7,%ecx
sub    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
lea    0xe8d(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <main+0x26>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xf(%rsp),%al
shr    $0x7,%al
movzbl %al,%esi
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
shr    $0x6,%esi
and    $0x1,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
shr    $0x5,%esi
and    $0x1,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
shr    $0x4,%esi
and    $0x1,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
shr    $0x3,%esi
and    $0x1,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
shr    $0x2,%esi
and    $0x1,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
shr    %esi
and    $0x1,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rsp),%esi
and    $0x1,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%hhd\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
store i32 0, i32* %3
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %3
%7 = icmp ult i32 %6, 8
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = load i32, i32* %3
%12 = sub i32 7, %11
%13 = ashr i32 %10, %12
%14 = and i32 %13, 1
%15 = trunc i32 %14 to i8
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %15)
br label %17
17: ; preds = %8
%18 = load i32, i32* %3
%19 = add i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
%21 = call i32 @putchar(i8 signext 10)
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [5 x i8] c"%hhd\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = lshr i8 %3, 7
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
%6 = load i8, i8* %1
%7 = lshr i8 %6, 6
%8 = and i8 %7, 1
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %8)
%10 = load i8, i8* %1
%11 = lshr i8 %10, 5
%12 = and i8 %11, 1
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %12)
%14 = load i8, i8* %1
%15 = lshr i8 %14, 4
%16 = and i8 %15, 1
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %16)
%18 = load i8, i8* %1
%19 = lshr i8 %18, 3
%20 = and i8 %19, 1
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %20)
%22 = load i8, i8* %1
%23 = lshr i8 %22, 2
%24 = and i8 %23, 1
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %24)
%26 = load i8, i8* %1
%27 = lshr i8 %26, 1
%28 = and i8 %27, 1
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %28)
%30 = load i8, i8* %1
%31 = and i8 %30, 1
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %31)
%33 = call i32 @putchar(i8 signext 10)
ret i32 0
}