#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 */
scalar_t__ check_input(char *, int *, int *);
int /*<<< orphan*/ convert(char *, int *, int *);
scalar_t__ get_input(char *, int *, int *);
scalar_t__ set_output(char *);
int str_len(char *);
int main(void) {
  int err = 0;
  char x[(13 - 1) * (16 / 2)] = "";
  int b1 = 0, b2 = 0;
  err += get_input(x, &b1, &b2);
  if (check_input(x, &b1, &b2)) {
    int h = 0, i = 0;
    convert(x, &b1, &b2);
    h = str_len(x);
    if (x[h - 1] == '.') {
      for (i = 0; i < 12; i++) {
        x[h + i] = '0';
      }
    }
    err += set_output(x);
  } else {
    err += set_output("bad input");
  }
  return err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1050 <memset@plt>
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0x74(%rbp),%rsi
lea    -0x78(%rbp),%rdx
call   1080 <get_input@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0x74(%rbp),%rsi
lea    -0x78(%rbp),%rdx
call   1040 <check_input@plt>
cmp    $0x0,%rax
je     125d <main+0xfd>
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x80(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0x74(%rbp),%rsi
lea    -0x78(%rbp),%rdx
call   1030 <convert@plt>
lea    -0x70(%rbp),%rdi
call   1070 <str_len@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x2e,%eax
jne    1242 <main+0xe2>
movl   $0x0,-0x80(%rbp)
cmpl   $0xc,-0x80(%rbp)
jge    123d <main+0xdd>
mov    -0x7c(%rbp),%eax
add    -0x80(%rbp),%eax
cltq
movb   $0x30,-0x70(%rbp,%rax,1)
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1218 <main+0xb8>
jmp    1242 <main+0xe2>
lea    -0x70(%rbp),%rdi
call   1060 <set_output@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
jmp    1276 <main+0x116>
lea    0xd9c(%rip),%rdi
call   1060 <set_output@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%r12
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1070 <get_input@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1040 <check_input@plt>
test   %rax,%rax
je     120f <main+0xbf>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
call   1030 <convert@plt>
mov    %r15,%rdi
call   1060 <str_len@plt>
cltq
cmpb   $0x2e,-0x1(%rax,%r15,1)
jne    11fa <main+0xaa>
movabs $0x3030303030303030,%rcx
30 30 30
mov    %rcx,0x10(%rsp,%rax,1)
movl   $0x30303030,0x18(%rsp,%rax,1)
30
lea    0x10(%rsp),%rdi
call   1050 <set_output@plt>
mov    %rax,%rcx
movslq %r14d,%rax
add    %rcx,%rax
jmp    121e <main+0xce>
lea    0xdea(%rip),%rdi
call   1050 <set_output@plt>
add    %r14,%rax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"bad input\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [96 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%8 = bitcast [96 x i8]* %3 to i8*
store i32 0, i32* %4
store i32 0, i32* %5
%9 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 0
%10 = call i64 @get_input(i8* %9, i32* %4, i32* %5)
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = add nsw i64 %12, %10
%14 = trunc i64 %13 to i32
store i32 %14, i32* %2
%15 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 0
%16 = call i64 @check_input(i8* %15, i32* %4, i32* %5)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %51
18: ; preds = %0
store i32 0, i32* %6
store i32 0, i32* %7
%19 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 0
%20 = call i32 @convert(i8* %19, i32* %4, i32* %5)
%21 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 0
%22 = call i32 @str_len(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 46
br i1 %29, label %30, label %44
30: ; preds = %18
store i32 0, i32* %7
br label %31
31: ; preds = %40, %30
%32 = load i32, i32* %7
%33 = icmp slt i32 %32, 12
br i1 %33, label %34, label %43
34: ; preds = %31
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = add nsw i32 %35, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 %38
store i8 48, i8* %39
br label %40
40: ; preds = %34
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %31
43: ; preds = %31
br label %44
44: ; preds = %43, %18
%45 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 0
%46 = call i64 @set_output(i8* %45)
%47 = load i32, i32* %2
%48 = sext i32 %47 to i64
%49 = add nsw i64 %48, %46
%50 = trunc i64 %49 to i32
store i32 %50, i32* %2
br label %57
51: ; preds = %0
%52 = call i64 @set_output(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%53 = load i32, i32* %2
%54 = sext i32 %53 to i64
%55 = add nsw i64 %54, %52
%56 = trunc i64 %55 to i32
store i32 %56, i32* %2
br label %57
57: ; preds = %51, %44
%58 = load i32, i32* %2
ret i32 %58
}

LLVM IR (-O2):
@.str = [10 x i8] c"bad input\00"
define i32 @main() {
%1 = alloca [96 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = getelementptr inbounds [96 x i8], [96 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = call i64 @get_input(i8* %4, i32* %2, i32* %3)
%8 = call i64 @check_input(i8* %4, i32* %2, i32* %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %0
%11 = call i32 @convert(i8* %4, i32* %2, i32* %3)
%12 = call i32 @str_len(i8* %4)
%13 = add nsw i32 %12, -1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [96 x i8], [96 x i8]* %1, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 46
br i1 %17, label %18, label %21
18: ; preds = %10
%19 = sext i32 %12 to i64
%20 = getelementptr [96 x i8], [96 x i8]* %1, i64 0, i64 %19
br label %21
21: ; preds = %18, %10
%22 = call i64 @set_output(i8* %4)
%23 = shl i64 %7, 32
%24 = ashr exact i64 %23, 32
%25 = add nsw i64 %22, %24
br label %29
26: ; preds = %0
%27 = call i64 @set_output(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%28 = add i64 %27, %7
br label %29
29: ; preds = %26, %21
%30 = phi i64 [ %25, %21 ], [ %28, %26 ]
%31 = trunc i64 %30 to i32
ret i32 %31
}