#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*/ scanf(char *, long long *);
int main() {
  long long int code;
  int sum = 0, i = 9;
  printf("Enter the 10 digit ISBN code: ");
  scanf("%lld", &code);
  int r = code % 10;
  code = code / 10;
  while (code > 0) {
    sum += i * (code % 10);
    code /= 10;
    i--;
  }
  if (sum % 11 == r)
    printf("Its a ISBN Code \n");
  else
    printf("Its not a ISBN Code \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x9,-0x18(%rbp)
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    11c9 <main+0xa9>
movslq -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    $0xa,%esi
cqto
idiv   %rsi
imul   %rdx,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    117e <main+0x5e>
mov    -0x14(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
cmp    -0x1c(%rbp),%edx
jne    11ee <main+0xce>
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
jmp    11fa <main+0xda>
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rcx
movabs $0x6666666666666667,%rdx
66 66 66
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rcx,%r8
sub    %rax,%r8
mov    %rdx,(%rsp)
xor    %eax,%eax
cmp    $0xa,%rcx
jl     11ea <main+0xba>
mov    $0x9,%esi
xor    %edi,%edi
movabs $0xcccccccccccccccd,%r9
cc cc cc
nopl   0x0(%rax)
mov    %rdx,%rcx
mov    %rdx,%rax
mul    %r9
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%r10d
mov    %ecx,%eax
sub    %r10d,%eax
imul   %esi,%eax
add    %eax,%edi
add    $0xffffffff,%esi
cmp    $0x9,%rcx
ja     11a0 <main+0x70>
mov    %rdx,(%rsp)
movslq %edi,%rax
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
cmp    %r8d,%eax
lea    0xe45(%rip),%rax
lea    0xe29(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Enter the 10 digit ISBN code: \00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [18 x i8] c"Its a ISBN Code \0A\00"
@.str.3 = [22 x i8] c"Its not a ISBN Code \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 9, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%8 = load i64, i64* %2
%9 = srem i64 %8, 10
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = load i64, i64* %2
%12 = sdiv i64 %11, 10
store i64 %12, i64* %2
br label %13
13: ; preds = %16, %0
%14 = load i64, i64* %2
%15 = icmp sgt i64 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %13
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = load i64, i64* %2
%20 = srem i64 %19, 10
%21 = mul nsw i64 %18, %20
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = add nsw i64 %23, %21
%25 = trunc i64 %24 to i32
store i32 %25, i32* %3
%26 = load i64, i64* %2
%27 = sdiv i64 %26, 10
store i64 %27, i64* %2
%28 = load i32, i32* %4
%29 = add nsw i32 %28, -1
store i32 %29, i32* %4
br label %13
30: ; preds = %13
%31 = load i32, i32* %3
%32 = srem i32 %31, 11
%33 = load i32, i32* %5
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %39
37: ; preds = %30
%38 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Enter the 10 digit ISBN code: \00"
@.str.1 = [5 x i8] c"%lld\00"
@str = [21 x i8] c"Its not a ISBN Code \00"
@str.4 = [17 x i8] c"Its a ISBN Code \00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%5 = load i64, i64* %1
%6 = sdiv i64 %5, 10
%7 = srem i64 %5, 10
store i64 %6, i64* %1
%8 = icmp sgt i64 %5, 9
br i1 %8, label %9, label %22
9: ; preds = %0, %9
%10 = phi i32 [ %16, %9 ], [ 0, %0 ]
%11 = phi i32 [ %18, %9 ], [ 9, %0 ]
%12 = phi i64 [ %17, %9 ], [ %6, %0 ]
%13 = urem i64 %12, 10
%14 = trunc i64 %13 to i32
%15 = mul i32 %11, %14
%16 = add i32 %15, %10
%17 = udiv i64 %12, 10
%18 = add nsw i32 %11, -1
%19 = icmp ult i64 %12, 10
br i1 %19, label %20, label %9
20: ; preds = %9
store i64 %17, i64* %1
%21 = srem i32 %16, 11
br label %22
22: ; preds = %20, %0
%23 = phi i32 [ %21, %20 ], [ 0, %0 ]
%24 = trunc i64 %7 to i32
%25 = icmp eq i32 %23, %24
%26 = select i1 %25, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0)
%27 = call i32 @puts(i8* dereferenceable(1) %26)
ret i32 0
}