#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 i, b;
  printf("Данное число переведем в двоичную систему - ");
  scanf("%d", &i);
  while (i != 0) {
    b = i % 2;
    i = i / 2;
    printf("%d", b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1189 <main+0x69>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114d <main+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf17(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1186 <main+0x66>
lea    0xefe(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
mov    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%esi
sar    %eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [81 x i8] c"\D0\94\D0\B0\D0\BD\D0\BD\D0\BE\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE \D0\BF\D0\B5\D1\80\D0\B5\D0\B2\D0\B5\D0\B4\D0\B5\D0\BC \D0\B2 \D0\B4\D0\B2\D0\BE\D0\B8\D1\87\D0\BD\D1\83\D1\8E \D1\81\D0\B8\D1\81\D1\82\D0\B5\D0\BC\D1\83 - \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %2
%11 = srem i32 %10, 2
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 2
store i32 %13, i32* %2
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %6
16: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [81 x i8] c"\D0\94\D0\B0\D0\BD\D0\BD\D0\BE\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE \D0\BF\D0\B5\D1\80\D0\B5\D0\B2\D0\B5\D0\B4\D0\B5\D0\BC \D0\B2 \D0\B4\D0\B2\D0\BE\D0\B8\D1\87\D0\BD\D1\83\D1\8E \D1\81\D0\B8\D1\81\D1\82\D0\B5\D0\BC\D1\83 - \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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 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 eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %12, %7 ], [ %5, %0 ]
%9 = srem i32 %8, 2
%10 = sdiv i32 %8, 2
store i32 %10, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %0
ret i32 0
}