#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 *, int *);
main() {
  int a, b, i;
  printf("Введите десятичное число: ");
  scanf("%d", &a);
  b = 128;
  i = 1;
  while (i <= 8) {
    i++;
    if (a >= b) {
      printf("1");
      a -= b;
    } else
      printf("0");
    b /= 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x80,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jg     11b3 <main+0x93>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1194 <main+0x74>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    11a0 <main+0x80>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1159 <main+0x39>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x80,0x4(%rsp)
jge    1223 <main+0xf3>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    $0x40,%eax
jl     1241 <main+0x111>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
add    $0xffffffc0,%eax
mov    %eax,0x4(%rsp)
cmp    $0x20,%eax
jl     1258 <main+0x128>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
add    $0xffffffe0,%eax
mov    %eax,0x4(%rsp)
cmp    $0x10,%eax
jl     126f <main+0x13f>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
add    $0xfffffff0,%eax
mov    %eax,0x4(%rsp)
cmp    $0x8,%eax
jl     1286 <main+0x156>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
add    $0xfffffff8,%eax
mov    %eax,0x4(%rsp)
cmp    $0x4,%eax
jl     129d <main+0x16d>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
add    $0xfffffffc,%eax
mov    %eax,0x4(%rsp)
cmp    $0x2,%eax
jl     12b4 <main+0x184>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
add    $0xfffffffe,%eax
mov    %eax,0x4(%rsp)
jmp    12c2 <main+0x192>
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
add    $0xffffff80,%eax
mov    %eax,0x4(%rsp)
cmp    $0x40,%eax
jge    1173 <main+0x43>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    $0x20,%eax
jge    1191 <main+0x61>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    $0x10,%eax
jge    11af <main+0x7f>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    $0x8,%eax
jge    11cd <main+0x9d>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    $0x4,%eax
jge    11eb <main+0xbb>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jge    1209 <main+0xd9>
mov    $0x30,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
xor    %edi,%edi
test   %eax,%eax
setle  %dil
xor    $0x31,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\B4\D0\B5\D1\81\D1\8F\D1\82\D0\B8\D1\87\D0\BD\D0\BE\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 128, i32* %3
store i32 1, i32* %4
br label %7
7: ; preds = %23, %0
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 8
br i1 %9, label %10, label %26
10: ; preds = %7
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, %18
store i32 %20, i32* %2
br label %23
21: ; preds = %10
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %21, %16
%24 = load i32, i32* %3
%25 = sdiv i32 %24, 2
store i32 %25, i32* %3
br label %7
26: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\B4\D0\B5\D1\81\D1\8F\D1\82\D0\B8\D1\87\D0\BD\D0\BE\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 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 = icmp slt i32 %5, 128
br i1 %6, label %11, label %7
7: ; preds = %0
%8 = call i32 @putchar(i32 49)
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -128
store i32 %10, i32* %1
br label %14
11: ; preds = %0
%12 = call i32 @putchar(i32 48)
%13 = load i32, i32* %1
br label %14
14: ; preds = %11, %7
%15 = phi i32 [ %13, %11 ], [ %10, %7 ]
%16 = icmp slt i32 %15, 64
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = call i32 @putchar(i32 49)
%19 = load i32, i32* %1
%20 = add nsw i32 %19, -64
store i32 %20, i32* %1
br label %24
21: ; preds = %14
%22 = call i32 @putchar(i32 48)
%23 = load i32, i32* %1
br label %24
24: ; preds = %21, %17
%25 = phi i32 [ %23, %21 ], [ %20, %17 ]
%26 = icmp slt i32 %25, 32
br i1 %26, label %31, label %27
27: ; preds = %24
%28 = call i32 @putchar(i32 49)
%29 = load i32, i32* %1
%30 = add nsw i32 %29, -32
store i32 %30, i32* %1
br label %34
31: ; preds = %24
%32 = call i32 @putchar(i32 48)
%33 = load i32, i32* %1
br label %34
34: ; preds = %31, %27
%35 = phi i32 [ %33, %31 ], [ %30, %27 ]
%36 = icmp slt i32 %35, 16
br i1 %36, label %41, label %37
37: ; preds = %34
%38 = call i32 @putchar(i32 49)
%39 = load i32, i32* %1
%40 = add nsw i32 %39, -16
store i32 %40, i32* %1
br label %44
41: ; preds = %34
%42 = call i32 @putchar(i32 48)
%43 = load i32, i32* %1
br label %44
44: ; preds = %41, %37
%45 = phi i32 [ %43, %41 ], [ %40, %37 ]
%46 = icmp slt i32 %45, 8
br i1 %46, label %51, label %47
47: ; preds = %44
%48 = call i32 @putchar(i32 49)
%49 = load i32, i32* %1
%50 = add nsw i32 %49, -8
store i32 %50, i32* %1
br label %54
51: ; preds = %44
%52 = call i32 @putchar(i32 48)
%53 = load i32, i32* %1
br label %54
54: ; preds = %51, %47
%55 = phi i32 [ %53, %51 ], [ %50, %47 ]
%56 = icmp slt i32 %55, 4
br i1 %56, label %61, label %57
57: ; preds = %54
%58 = call i32 @putchar(i32 49)
%59 = load i32, i32* %1
%60 = add nsw i32 %59, -4
store i32 %60, i32* %1
br label %64
61: ; preds = %54
%62 = call i32 @putchar(i32 48)
%63 = load i32, i32* %1
br label %64
64: ; preds = %61, %57
%65 = phi i32 [ %63, %61 ], [ %60, %57 ]
%66 = icmp slt i32 %65, 2
br i1 %66, label %71, label %67
67: ; preds = %64
%68 = call i32 @putchar(i32 49)
%69 = load i32, i32* %1
%70 = add nsw i32 %69, -2
store i32 %70, i32* %1
br label %74
71: ; preds = %64
%72 = call i32 @putchar(i32 48)
%73 = load i32, i32* %1
br label %74
74: ; preds = %71, %67
%75 = phi i32 [ %73, %71 ], [ %70, %67 ]
%76 = icmp slt i32 %75, 1
%77 = select i1 %76, i32 48, i32 49
%78 = call i32 @putchar(i32 %77)
ret i32 0
}