#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 */
long toint(char);
long int credential_number(char fascn[40]) {
  long int temp;
  temp = toint(fascn[11]) * 100000;
  temp += toint(fascn[12]) * 10000;
  temp += toint(fascn[13]) * 1000;
  temp += toint(fascn[14]) * 100;
  temp += toint(fascn[15]) * 10;
  temp += toint(fascn[16]);
  return (temp);
}


x86 assembly (clang, -O0):
<credential_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0xb(%rax),%edi
call   1030 <toint@plt>
imul   $0x186a0,%rax,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0xc(%rax),%edi
call   1030 <toint@plt>
imul   $0x2710,%rax,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0xd(%rax),%edi
call   1030 <toint@plt>
imul   $0x3e8,%rax,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0xe(%rax),%edi
call   1030 <toint@plt>
imul   $0x64,%rax,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0xf(%rax),%edi
call   1030 <toint@plt>
imul   $0xa,%rax,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x10(%rax),%edi
call   1030 <toint@plt>
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<credential_number>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
movsbl 0xb(%rdi),%edi
call   1030 <toint@plt>
imul   $0x186a0,%rax,%r14
movsbl 0xc(%r15),%edi
call   1030 <toint@plt>
imul   $0x2710,%rax,%rbx
add    %r14,%rbx
movsbl 0xd(%r15),%edi
call   1030 <toint@plt>
imul   $0x3e8,%rax,%r14
add    %rbx,%r14
movsbl 0xe(%r15),%edi
call   1030 <toint@plt>
imul   $0x64,%rax,%rbx
add    %r14,%rbx
movsbl 0xf(%r15),%edi
call   1030 <toint@plt>
lea    (%rax,%rax,4),%rax
lea    (%rbx,%rax,2),%rbx
movsbl 0x10(%r15),%edi
call   1030 <toint@plt>
add    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @credential_number(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 11
%6 = load i8, i8* %5
%7 = call i64 @toint(i8 signext %6)
%8 = mul nsw i64 %7, 100000
store i64 %8, i64* %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 12
%11 = load i8, i8* %10
%12 = call i64 @toint(i8 signext %11)
%13 = mul nsw i64 %12, 10000
%14 = load i64, i64* %3
%15 = add nsw i64 %14, %13
store i64 %15, i64* %3
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 13
%18 = load i8, i8* %17
%19 = call i64 @toint(i8 signext %18)
%20 = mul nsw i64 %19, 1000
%21 = load i64, i64* %3
%22 = add nsw i64 %21, %20
store i64 %22, i64* %3
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i64 14
%25 = load i8, i8* %24
%26 = call i64 @toint(i8 signext %25)
%27 = mul nsw i64 %26, 100
%28 = load i64, i64* %3
%29 = add nsw i64 %28, %27
store i64 %29, i64* %3
%30 = load i8*, i8** %2
%31 = getelementptr inbounds i8, i8* %30, i64 15
%32 = load i8, i8* %31
%33 = call i64 @toint(i8 signext %32)
%34 = mul nsw i64 %33, 10
%35 = load i64, i64* %3
%36 = add nsw i64 %35, %34
store i64 %36, i64* %3
%37 = load i8*, i8** %2
%38 = getelementptr inbounds i8, i8* %37, i64 16
%39 = load i8, i8* %38
%40 = call i64 @toint(i8 signext %39)
%41 = load i64, i64* %3
%42 = add nsw i64 %41, %40
store i64 %42, i64* %3
%43 = load i64, i64* %3
ret i64 %43
}

LLVM IR (-O2):
define i64 @credential_number(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 11
%3 = load i8, i8* %2
%4 = tail call i64 @toint(i8 signext %3)
%5 = mul nsw i64 %4, 100000
%6 = getelementptr inbounds i8, i8* %0, i64 12
%7 = load i8, i8* %6
%8 = tail call i64 @toint(i8 signext %7)
%9 = mul nsw i64 %8, 10000
%10 = add nsw i64 %9, %5
%11 = getelementptr inbounds i8, i8* %0, i64 13
%12 = load i8, i8* %11
%13 = tail call i64 @toint(i8 signext %12)
%14 = mul nsw i64 %13, 1000
%15 = add nsw i64 %10, %14
%16 = getelementptr inbounds i8, i8* %0, i64 14
%17 = load i8, i8* %16
%18 = tail call i64 @toint(i8 signext %17)
%19 = mul nsw i64 %18, 100
%20 = add nsw i64 %15, %19
%21 = getelementptr inbounds i8, i8* %0, i64 15
%22 = load i8, i8* %21
%23 = tail call i64 @toint(i8 signext %22)
%24 = mul nsw i64 %23, 10
%25 = add nsw i64 %20, %24
%26 = getelementptr inbounds i8, i8* %0, i64 16
%27 = load i8, i8* %26
%28 = tail call i64 @toint(i8 signext %27)
%29 = add nsw i64 %25, %28
ret i64 %29
}