#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 nussinov(int, char *);
int /*<<< orphan*/ printf(char *, char *, int);
int scanf(char *, char **);
int strlen(char *);
int main() {
  char p[10000];
  int n;
  int e;
  while (1 == scanf("%9999s", &p)) {
    n = strlen(p);
    e = nussinov(n, p);
    printf("%s %d\n", p, e);
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2720(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1060 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    11bc <main+0x7c>
lea    -0x2720(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2724(%rbp)
mov    -0x2724(%rbp),%edi
lea    -0x2720(%rbp),%rsi
call   1050 <nussinov@plt>
mov    %eax,-0x2728(%rbp)
lea    -0x2720(%rbp),%rsi
mov    -0x2728(%rbp),%edx
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x2710,%rsp
lea    0xead(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    11af <main+0x6f>
mov    %rsp,%rbx
lea    0xe9d(%rip),%r14
lea    0xe8f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <nussinov@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
je     1180 <main+0x40>
xor    %eax,%eax
add    $0x2710,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%9999s\00"
@.str.1 = [7 x i8] c"%s %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10000 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %9, %0
%6 = bitcast [10000 x i8]* %2 to i8**
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %6)
%8 = icmp eq i32 1, %7
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%14 = call i32 @nussinov(i32 %12, i8* %13)
store i32 %14, i32* %4
%15 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%16 = load i32, i32* %4
%17 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %15, i32 %16)
br label %5
18: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%9999s\00"
@.str.1 = [7 x i8] c"%s %d\0A\00"
define i32 @main() {
%1 = alloca [10000 x i8]
%2 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%3 = bitcast [10000 x i8]* %1 to i8**
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %3)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %12
6: ; preds = %0, %6
%7 = call i32 @strlen(i8* %2)
%8 = call i32 @nussinov(i32 %7, i8* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %8)
%10 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %3)
%11 = icmp eq i32 %10, 1
br i1 %11, label %6, label %12
12: ; preds = %6, %0
ret i32 0
}