#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 */
char *calculateReal(char *, int);
int /*<<< orphan*/ convertReal(char *, double, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char numb[100];
  printf("!!! Демонстрация на преобразуването между бройни системи !!!\n");
  convertReal(numb, 777.777, 7, 10);
  printf("Седмичният запис на 777.777 (10) е %s\n", numb);
  strcpy(numb, "11.D873");
  printf("Десетичният запис на 11.D873 (16) е: %0.10lf\n",
         calculateReal(numb, 16));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
movsd  0xe97(%rip),%xmm0
mov    $0x7,%esi
mov    $0xa,%edx
call   1040 <convertReal@plt>
lea    -0x70(%rbp),%rsi
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xf19(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
mov    $0x10,%esi
call   1050 <calculateReal@plt>
mov    %rax,%rsi
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xf2e(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
movsd  0xe94(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0xa,%edx
call   1050 <convertReal@plt>
lea    0xe83(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1060 <calculateReal@plt>
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [109 x i8] c"!!! \D0\94\D0\B5\D0\BC\D0\BE\D0\BD\D1\81\D1\82\D1\80\D0\B0\D1\86\D0\B8\D1\8F \D0\BD\D0\B0 \D0\BF\D1\80\D0\B5\D0\BE\D0\B1\D1\80\D0\B0\D0\B7\D1\83\D0\B2\D0\B0\D0\BD\D0\B5\D1\82\D0\BE \D0\BC\D0\B5\D0\B6\D0\B4\D1\83 \D0\B1\D1\80\D0\BE\D0\B9\D0\BD\D0\B8 \D1\81\D0\B8\D1\81\D1\82\D0\B5\D0\BC\D0\B8 !!!\0A\00"
@.str.1 = [57 x i8] c"\D0\A1\D0\B5\D0\B4\D0\BC\D0\B8\D1\87\D0\BD\D0\B8\D1\8F\D1\82 \D0\B7\D0\B0\D0\BF\D0\B8\D1\81 \D0\BD\D0\B0 777.777 (10) \D0\B5 %s\0A\00"
@.str.2 = [8 x i8] c"11.D873\00"
@.str.3 = [65 x i8] c"\D0\94\D0\B5\D1\81\D0\B5\D1\82\D0\B8\D1\87\D0\BD\D0\B8\D1\8F\D1\82 \D0\B7\D0\B0\D0\BF\D0\B8\D1\81 \D0\BD\D0\B0 11.D873 (16) \D0\B5: %0.10lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @convertReal(i8* %4, double 7.777770e+02, i32 7, i32 10)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i8* @calculateReal(i8* %10, i32 16)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [57 x i8] c"\D0\A1\D0\B5\D0\B4\D0\BC\D0\B8\D1\87\D0\BD\D0\B8\D1\8F\D1\82 \D0\B7\D0\B0\D0\BF\D0\B8\D1\81 \D0\BD\D0\B0 777.777 (10) \D0\B5 %s\0A\00"
@.str.2 = [8 x i8] c"11.D873\00"
@.str.3 = [65 x i8] c"\D0\94\D0\B5\D1\81\D0\B5\D1\82\D0\B8\D1\87\D0\BD\D0\B8\D1\8F\D1\82 \D0\B7\D0\B0\D0\BF\D0\B8\D1\81 \D0\BD\D0\B0 11.D873 (16) \D0\B5: %0.10lf\0A\00"
@str = [108 x i8] c"!!! \D0\94\D0\B5\D0\BC\D0\BE\D0\BD\D1\81\D1\82\D1\80\D0\B0\D1\86\D0\B8\D1\8F \D0\BD\D0\B0 \D0\BF\D1\80\D0\B5\D0\BE\D0\B1\D1\80\D0\B0\D0\B7\D1\83\D0\B2\D0\B0\D0\BD\D0\B5\D1\82\D0\BE \D0\BC\D0\B5\D0\B6\D0\B4\D1\83 \D0\B1\D1\80\D0\BE\D0\B9\D0\BD\D0\B8 \D1\81\D0\B8\D1\81\D1\82\D0\B5\D0\BC\D0\B8 !!!\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @str, i64 0, i64 0))
%4 = call i32 @convertReal(i8* %2, double 7.777770e+02, i32 7, i32 10)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = call i8* @calculateReal(i8* %2, i32 16)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0), i8* %7)
ret i32 0
}