#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 *, int *);
int main(int argc, char *argv[]) {
  int bank_code = 0, guichet_code = 0, account_num1 = 0, account_num2 = 0,
      key_rib = 0;
  printf("Program for find the RIB key - programming by Lyes Belhadj\n");
  printf("\nEnter bank code: ");
  scanf("%d", &bank_code);
  printf("\nEnter guichet code: ");
  scanf("%d", &guichet_code);
  printf("\nEnter the first part of number account (it's the five number of "
         "number account): ");
  scanf("%d", &account_num1);
  printf("\nEnter the second part of number account (it's the six fallowing "
         "number of number account): ");
  scanf("%d", &account_num2);
  key_rib = 97 - (89 * bank_code + 15 * guichet_code + 81 * account_num1 +
                  3 * account_num2) %
                     97;
  printf("The key of RIB is: %d", key_rib);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfac(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf8e(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf70(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf52(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
imul   $0x59,-0x14(%rbp),%eax
imul   $0xf,-0x18(%rbp),%ecx
add    %ecx,%eax
imul   $0x51,-0x1c(%rbp),%ecx
add    %ecx,%eax
imul   $0x3,-0x20(%rbp),%ecx
add    %ecx,%eax
mov    $0x61,%ecx
cltd
idiv   %ecx
mov    $0x61,%eax
sub    %edx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xf94(%rip),%rdi
call   1030 <puts@plt>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf77(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
imul   $0x59,0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,2),%ecx
add    %eax,%ecx
mov    0x4(%rsp),%eax
lea    (%rax,%rax,8),%eax
lea    (%rax,%rax,8),%eax
add    %ecx,%eax
mov    (%rsp),%ecx
lea    (%rcx,%rcx,2),%ecx
add    %eax,%ecx
movslq %ecx,%rax
imul   $0x151d07eb,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
imul   $0x61,%ecx,%esi
sub    %eax,%esi
add    $0x61,%esi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Program for find the RIB key - programming by Lyes Belhadj\0A\00"
@.str.1 = [19 x i8] c"\0AEnter bank code: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"\0AEnter guichet code: \00"
@.str.4 = [83 x i8] c"\0AEnter the first part of number account (it's the five number of number account): \00"
@.str.5 = [93 x i8] c"\0AEnter the second part of number account (it's the six fallowing number of number account): \00"
@.str.6 = [22 x i8] c"The key of RIB is: %d\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%20 = load i32, i32* %6
%21 = mul nsw i32 89, %20
%22 = load i32, i32* %7
%23 = mul nsw i32 15, %22
%24 = add nsw i32 %21, %23
%25 = load i32, i32* %8
%26 = mul nsw i32 81, %25
%27 = add nsw i32 %24, %26
%28 = load i32, i32* %9
%29 = mul nsw i32 3, %28
%30 = add nsw i32 %27, %29
%31 = srem i32 %30, 97
%32 = sub nsw i32 97, %31
store i32 %32, i32* %10
%33 = load i32, i32* %10
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"\0AEnter bank code: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"\0AEnter guichet code: \00"
@.str.4 = [83 x i8] c"\0AEnter the first part of number account (it's the five number of number account): \00"
@.str.5 = [93 x i8] c"\0AEnter the second part of number account (it's the six fallowing number of number account): \00"
@.str.6 = [22 x i8] c"The key of RIB is: %d\00"
@str = [59 x i8] c"Program for find the RIB key - programming by Lyes Belhadj\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%20 = load i32, i32* %3
%21 = mul nsw i32 %20, 89
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, 15
%24 = add nsw i32 %23, %21
%25 = load i32, i32* %5
%26 = mul nsw i32 %25, 81
%27 = add nsw i32 %24, %26
%28 = load i32, i32* %6
%29 = mul nsw i32 %28, 3
%30 = add nsw i32 %27, %29
%31 = srem i32 %30, 97
%32 = sub nsw i32 97, %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %32)
ret i32 0
}