#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*/ recoursive_one_or_two_fit(char *, int, int /*<<< orphan*/,
                                             int *);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
void main(void) {
  char string_of_numbers[129];
  int string_of_numbers_strlen;
  int i;
  int counter = 0;
  printf("enter a number: ");
  scanf("%128s", string_of_numbers);
  string_of_numbers_strlen = strlen(string_of_numbers);
  for (i = 0; i < string_of_numbers_strlen; i++) {
    if (string_of_numbers[i] < '0' || string_of_numbers[i] > '9') {
      printf("please enter only numbers\n");
      return;
    }
  }
  recoursive_one_or_two_fit(string_of_numbers, string_of_numbers_strlen, 0,
                            &counter);
  printf("number of permutations is %d\n", counter);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x9c(%rbp)
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x94(%rbp)
movl   $0x0,-0x98(%rbp)
mov    -0x98(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    1200 <main+0xc0>
movslq -0x98(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
jl     11d4 <main+0x94>
movslq -0x98(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%eax
ff
cmp    $0x39,%eax
jle    11e7 <main+0xa7>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122f <main+0xef>
jmp    11ec <main+0xac>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1192 <main+0x52>
lea    -0x90(%rbp),%rdi
mov    -0x94(%rbp),%esi
xor    %edx,%edx
lea    -0x9c(%rbp),%rcx
call   1050 <recoursive_one_or_two_fit@plt>
mov    -0x9c(%rbp),%esi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xa0,%rsp
movl   $0x0,0xc(%rsp)
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11b6 <main+0x66>
mov    %eax,%ecx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x10(%rsp,%rdx,1),%ebx
add    $0xc6,%bl
cmp    $0xf5,%bl
jbe    11dd <main+0x8d>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    11a0 <main+0x50>
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rcx
mov    %eax,%esi
xor    %edx,%edx
call   1060 <recoursive_one_or_two_fit@plt>
mov    0xc(%rsp),%esi
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11e9 <main+0x99>
lea    0xe51(%rip),%rdi
call   1030 <puts@plt>
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"enter a number: \00"
@.str.1 = [6 x i8] c"%128s\00"
@.str.2 = [27 x i8] c"please enter only numbers\0A\00"
@.str.3 = [30 x i8] c"number of permutations is %d\0A\00"
define void @main() {
%1 = alloca [129 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [129 x i8], [129 x i8]* %1, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [129 x i8], [129 x i8]* %1, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %2
store i32 0, i32* %3
br label %10
10: ; preds = %31, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %34
14: ; preds = %10
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [129 x i8], [129 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp slt i32 %19, 48
br i1 %20, label %28, label %21
21: ; preds = %14
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [129 x i8], [129 x i8]* %1, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sgt i32 %26, 57
br i1 %27, label %28, label %30
28: ; preds = %21, %14
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %40
30: ; preds = %21
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %10
34: ; preds = %10
%35 = getelementptr inbounds [129 x i8], [129 x i8]* %1, i64 0, i64 0
%36 = load i32, i32* %2
%37 = call i32 @recoursive_one_or_two_fit(i8* %35, i32 %36, i32 0, i32* %4)
%38 = load i32, i32* %4
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %34, %28
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"enter a number: \00"
@.str.1 = [6 x i8] c"%128s\00"
@.str.3 = [30 x i8] c"number of permutations is %d\0A\00"
@str = [26 x i8] c"please enter only numbers\00"
define void @main() {
%1 = alloca [129 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [129 x i8], [129 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @strlen(i8* %3)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %0
%10 = zext i32 %7 to i64
br label %13
11: ; preds = %13
%12 = icmp eq i64 %19, %10
br i1 %12, label %22, label %13
13: ; preds = %9, %11
%14 = phi i64 [ 0, %9 ], [ %19, %11 ]
%15 = getelementptr inbounds [129 x i8], [129 x i8]* %1, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = add i8 %16, -58
%18 = icmp ult i8 %17, -10
%19 = add nuw nsw i64 %14, 1
br i1 %18, label %20, label %11
20: ; preds = %13
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %26
22: ; preds = %11, %0
%23 = call i32 @recoursive_one_or_two_fit(i8* %3, i32 %7, i32 0, i32* %2)
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %20
ret void
}