#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 get(char);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *, int *);
int strlen(char *);
int main(int argc, char *argv[]) {
  int b, i, j, out = 0;
  char a[100];
  scanf("%s%i", a, &b);
  for (i = 1, j = strlen(a) - 1; j >= 0; i *= b, j--)
    out += get(a[j]) * i;
  printf("%i", out);
  if (argc > 1)
    for (;;)
      ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x90(%rbp),%rsi
lea    0xe92(%rip),%rdi
lea    -0x14(%rbp),%rdx
call   1060 <scanf@plt>
movl   $0x1,-0x18(%rbp)
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     11cd <main+0x8d>
movslq -0x1c(%rbp),%rax
movsbl -0x90(%rbp,%rax,1),%edi
ff
call   1050 <get@plt>
imul   -0x18(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1190 <main+0x50>
mov    -0x20(%rbp),%esi
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11f0 <main+0xb0>
jmp    11eb <main+0xab>
jmp    11eb <main+0xab>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %edi,%r14d
lea    0xeac(%rip),%rdi
lea    0x10(%rsp),%rbp
lea    0xc(%rsp),%rdx
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11a4 <main+0x64>
mov    %eax,%ebx
add    $0x1,%rbx
mov    $0x1,%ebp
xor    %r15d,%r15d
lea    -0x2(%rbx),%eax
movsbl 0x10(%rsp,%rax,1),%edi
call   1050 <get@plt>
imul   %ebp,%eax
add    %eax,%r15d
imul   0xc(%rsp),%ebp
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1180 <main+0x40>
jmp    11a7 <main+0x67>
xor    %r15d,%r15d
lea    0xe54(%rip),%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
cmp    $0x2,%r14d
jl     11c2 <main+0x82>
nopl   0x0(%rax)
jmp    11c0 <main+0x80>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%i\00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %11, i32* %6)
store i32 1, i32* %7
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %8
br label %16
16: ; preds = %29, %2
%17 = load i32, i32* %8
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %35
19: ; preds = %16
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = call i32 @get(i8 signext %23)
%25 = load i32, i32* %7
%26 = mul nsw i32 %24, %25
%27 = load i32, i32* %9
%28 = add nsw i32 %27, %26
store i32 %28, i32* %9
br label %29
29: ; preds = %19
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = mul nsw i32 %31, %30
store i32 %32, i32* %7
%33 = load i32, i32* %8
%34 = add nsw i32 %33, -1
store i32 %34, i32* %8
br label %16
35: ; preds = %16
%36 = load i32, i32* %9
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %4
%39 = icmp sgt i32 %38, 1
br i1 %39, label %40, label %42
40: ; preds = %35
br label %41
41: ; preds = %41, %40
br label %41
42: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%i\00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6, i32* %3)
%8 = call i32 @strlen(i8* %6)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %2
%11 = zext i32 %8 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ %11, %10 ], [ %16, %12 ]
%14 = phi i32 [ 0, %10 ], [ %22, %12 ]
%15 = phi i32 [ 1, %10 ], [ %24, %12 ]
%16 = add nsw i64 %13, -1
%17 = and i64 %16, 4294967295
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call i32 @get(i8 signext %19)
%21 = mul nsw i32 %20, %15
%22 = add nsw i32 %21, %14
%23 = load i32, i32* %3
%24 = mul nsw i32 %23, %15
%25 = icmp ugt i64 %13, 1
br i1 %25, label %12, label %26
26: ; preds = %12, %2
%27 = phi i32 [ 0, %2 ], [ %22, %12 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = icmp sgt i32 %0, 1
br i1 %29, label %30, label %31
30: ; preds = %26, %30
br label %30
31: ; preds = %26
ret i32 0
}