#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 */
typedef int /*<<< orphan*/ numbers;

/* Variables and functions */
int atoi(char *);
int *charArrayToIntArray(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf("Składnia: <liczba> <liczba cyfr po przecinku>\n");
    exit(1);
  }
  char *czesciRownania[2];
  char *s2 = strtok(argv[1], ".");
  int p = -1;
  while (s2 != NULL) {
    p++;
    czesciRownania[p] = s2;
    s2 = strtok(NULL, ".");
  }
  printf("0.");
  int a, i, temp;
  int *numbers;
  numbers = charArrayToIntArray(czesciRownania[1]);
  for (i = 0; i < atoi(argv[2]); i++) {
    temp = 0;
    for (a = sizeof(numbers) / sizeof(int); a >= 0; a--) {
      numbers[a] = 2 * numbers[a] + temp;
      temp = numbers[a] / 10;
      numbers[a] = numbers[a] % 10;
    }
    printf("%d", temp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1188 <main+0x38>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9a(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x28(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11e1 <main+0x91>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rcx
movslq -0x2c(%rbp),%rax
mov    %rcx,-0x20(%rbp,%rax,8)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe5e(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x28(%rbp)
jmp    11a7 <main+0x57>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <charArrayToIntArray@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jge    12b8 <main+0x168>
movl   $0x0,-0x38(%rbp)
movl   $0x2,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jl     1299 <main+0x149>
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
shl    $0x1,%edx
add    -0x38(%rbp),%edx
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    1231 <main+0xe1>
mov    -0x38(%rbp),%esi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1203 <main+0xb3>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
cmp    $0x3,%edi
jne    12b3 <main+0x153>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe80(%rip),%rsi
call   1060 <strtok@plt>
test   %rax,%rax
je     11be <main+0x5e>
mov    %rsp,%rbp
lea    0xe6c(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,0x0(%rbp)
xor    %edi,%edi
mov    %rbx,%rsi
call   1060 <strtok@plt>
add    $0x8,%rbp
test   %rax,%rax
jne    11a0 <main+0x40>
mov    0x8(%rsp),%rbx
jmp    11be <main+0x5e>
lea    0xe3b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <charArrayToIntArray@plt>
mov    %rax,%rbx
mov    0x10(%r14),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
jle    12a6 <main+0x146>
lea    0xe14(%rip),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq 0x8(%rbx),%rax
lea    (%rax,%rax,1),%ecx
imul   $0x66666667,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rax
add    %edx,%eax
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
mov    %ecx,0x8(%rbx)
mov    (%rbx),%ecx
mov    0x4(%rbx),%edx
lea    (%rax,%rdx,2),%eax
cltq
imul   $0x66666667,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%eax
mov    %eax,0x4(%rbx)
lea    (%rdx,%rcx,2),%eax
cltq
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rsi
add    %ecx,%esi
lea    (%rsi,%rsi,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,(%rbx)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
mov    0x10(%r14),%rdi
call   1070 <atoi@plt>
cmp    %eax,%ebp
jl     1200 <main+0xa0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd4c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"Sk\C5\82adnia: <liczba> <liczba cyfr po przecinku>\0A\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"0.\00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i8*]
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i8* @strtok(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %22, i8** %7
store i32 -1, i32* %8
br label %23
23: ; preds = %26, %18
%24 = load i8*, i8** %7
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
%29 = load i8*, i8** %7
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [2 x i8*], [2 x i8*]* %6, i64 0, i64 %31
store i8* %29, i8** %32
%33 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %33, i8** %7
br label %23
34: ; preds = %23
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%36 = getelementptr inbounds [2 x i8*], [2 x i8*]* %6, i64 0, i64 1
%37 = load i8*, i8** %36
%38 = call i32* @charArrayToIntArray(i8* %37)
store i32* %38, i32** %12
store i32 0, i32* %10
br label %39
39: ; preds = %85, %34
%40 = load i32, i32* %10
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = call i32 @atoi(i8* %43)
%45 = icmp slt i32 %40, %44
br i1 %45, label %46, label %88
46: ; preds = %39
store i32 0, i32* %11
store i32 2, i32* %9
br label %47
47: ; preds = %79, %46
%48 = load i32, i32* %9
%49 = icmp sge i32 %48, 0
br i1 %49, label %50, label %82
50: ; preds = %47
%51 = load i32*, i32** %12
%52 = load i32, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
%55 = load i32, i32* %54
%56 = mul nsw i32 2, %55
%57 = load i32, i32* %11
%58 = add nsw i32 %56, %57
%59 = load i32*, i32** %12
%60 = load i32, i32* %9
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
store i32 %58, i32* %62
%63 = load i32*, i32** %12
%64 = load i32, i32* %9
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
%67 = load i32, i32* %66
%68 = sdiv i32 %67, 10
store i32 %68, i32* %11
%69 = load i32*, i32** %12
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %69, i64 %71
%73 = load i32, i32* %72
%74 = srem i32 %73, 10
%75 = load i32*, i32** %12
%76 = load i32, i32* %9
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %75, i64 %77
store i32 %74, i32* %78
br label %79
79: ; preds = %50
%80 = load i32, i32* %9
%81 = add nsw i32 %80, -1
store i32 %81, i32* %9
br label %47
82: ; preds = %47
%83 = load i32, i32* %11
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %83)
br label %85
85: ; preds = %82
%86 = load i32, i32* %10
%87 = add nsw i32 %86, 1
store i32 %87, i32* %10
br label %39
88: ; preds = %39
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"0.\00"
@.str.3 = [3 x i8] c"%d\00"
@str = [47 x i8] c"Sk\C5\82adnia: <liczba> <liczba cyfr po przecinku>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i8*]
%4 = icmp eq i32 %0, 3
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = bitcast [2 x i8*]* %3 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i8* @strtok(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %24, label %14
14: ; preds = %8, %14
%15 = phi i64 [ %17, %14 ], [ -1, %8 ]
%16 = phi i8* [ %19, %14 ], [ %12, %8 ]
%17 = add nsw i64 %15, 1
%18 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 %17
store i8* %16, i8** %18
%19 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %14
21: ; preds = %14
%22 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 1
%23 = load i8*, i8** %22
br label %24
24: ; preds = %21, %8
%25 = phi i8* [ %23, %21 ], [ undef, %8 ]
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%27 = tail call i32* @charArrayToIntArray(i8* %25)
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = tail call i32 @atoi(i8* %29)
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %56
32: ; preds = %24
%33 = getelementptr inbounds i32, i32* %27, i64 2
%34 = getelementptr inbounds i32, i32* %27, i64 1
br label %35
35: ; preds = %32, %35
%36 = phi i32 [ %52, %35 ], [ 0, %32 ]
%37 = load i32, i32* %33
%38 = shl nsw i32 %37, 1
%39 = sdiv i32 %37, 5
%40 = srem i32 %38, 10
store i32 %40, i32* %33
%41 = load i32, i32* %34
%42 = shl nsw i32 %41, 1
%43 = add nsw i32 %42, %39
%44 = sdiv i32 %43, 10
%45 = srem i32 %43, 10
store i32 %45, i32* %34
%46 = load i32, i32* %27
%47 = shl nsw i32 %46, 1
%48 = add nsw i32 %47, %44
%49 = sdiv i32 %48, 10
%50 = srem i32 %48, 10
store i32 %50, i32* %27
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%52 = add nuw nsw i32 %36, 1
%53 = load i8*, i8** %28
%54 = tail call i32 @atoi(i8* %53)
%55 = icmp slt i32 %52, %54
br i1 %55, label %35, label %56
56: ; preds = %35, %24
ret i32 0
}