#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 convert(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main() {
  char str[64];
  int ans;
  while (scanf("%s", str) == 1 && str[0] != '0') {
    ans = convert(str, strlen(str));
    printf("%d\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1060 <scanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x55(%rbp)
jne    117c <main+0x3c>
movsbl -0x50(%rbp),%eax
cmp    $0x30,%eax
setne  %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
test   $0x1,%al
jne    118c <main+0x4c>
jmp    11bf <main+0x7f>
lea    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x50(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
call   1030 <convert@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%esi
lea    0xe4e(%rip),%rdi
call   1050 <printf@plt>
jmp    114f <main+0xf>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xeb0(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    11b2 <main+0x72>
cmpb   $0x30,(%rsp)
je     11b2 <main+0x72>
mov    %rsp,%rbx
lea    0xe96(%rip),%r14
lea    0xe8c(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <convert@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    11b2 <main+0x72>
cmpb   $0x30,(%rsp)
jne    1180 <main+0x40>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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