#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*/ multiplication(unsigned char *, int, unsigned char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned long *);
main() {
  int i = 0, j = 0;
  unsigned long int anum;
  unsigned long int bnum;
  unsigned long int mo;
  unsigned char a[5], b[5];
  printf("enter your operands:\n");
  scanf("%d", &anum);
  scanf("%d", &bnum);
  mo = anum;
  while (mo >= 256) {
    a[i] = mo & 0xff;
    mo >>= 8;
    printf("a[ %d ] = + %d * 256^%d\n", i, a[i], i);
    i++;
  }
  a[i] = mo;
  printf("a[ %d ] = + %d * 256^%d\n", i, a[i], i);
  printf("\n\n");
  mo = bnum;
  while (mo >= 256) {
    b[j] = mo & 0xff;
    mo >>= 8;
    printf("b[ %d ] = + %d * 256^%d\n", j, b[j], j);
    j++;
  }
  b[j] = mo;
  printf("b[ %d ] = + %d * 256^%d\n", j, b[j], j);
  printf("\n");
  multiplication(a, i, b, j);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea4(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x100,-0x28(%rbp)
jb     11dc <main+0xac>
mov    -0x28(%rbp),%rax
and    $0xff,%rax
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x2d(%rbp,%rax,1)
mov    -0x28(%rbp),%rax
shr    $0x8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
movzbl -0x2d(%rbp,%rax,1),%edx
mov    -0x8(%rbp),%ecx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1183 <main+0x53>
mov    -0x28(%rbp),%rax
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x2d(%rbp,%rax,1)
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
movzbl -0x2d(%rbp,%rax,1),%edx
mov    -0x8(%rbp),%ecx
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x100,-0x28(%rbp)
jb     1276 <main+0x146>
mov    -0x28(%rbp),%rax
and    $0xff,%rax
mov    %al,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x32(%rbp,%rax,1)
mov    -0x28(%rbp),%rax
shr    $0x8,%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
movzbl -0x32(%rbp,%rax,1),%edx
mov    -0xc(%rbp),%ecx
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    121d <main+0xed>
mov    -0x28(%rbp),%rax
mov    %al,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x32(%rbp,%rax,1)
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
movzbl -0x32(%rbp,%rax,1),%edx
mov    -0xc(%rbp),%ecx
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x2d(%rbp),%rdi
mov    -0x8(%rbp),%esi
lea    -0x32(%rbp),%rdx
mov    -0xc(%rbp),%ecx
call   1030 <multiplication@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
lea    0xe90(%rip),%rbx
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    0x18(%rsp),%rbx
xor    %r14d,%r14d
cmp    $0x100,%rbx
jb     11df <main+0x8f>
lea    0xe61(%rip),%r12
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%r13
mov    %r13b,0xb(%rsp,%r15,1)
shr    $0x8,%rbx
movzbl %r13b,%edx
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r15d,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r15
cmp    $0xffff,%r13
ja     11b0 <main+0x60>
jmp    11e2 <main+0x92>
xor    %r15d,%r15d
mov    %r15d,%eax
mov    %bl,0xb(%rsp,%rax,1)
lea    0xe13(%rip),%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe14(%rip),%rdi
call   1040 <puts@plt>
mov    0x10(%rsp),%rbx
cmp    $0x100,%rbx
jb     125d <main+0x10d>
lea    0xdfc(%rip),%r12
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%r13
mov    %r13b,0x6(%rsp,%r14,1)
shr    $0x8,%rbx
movzbl %r13b,%edx
mov    %r12,%rdi
mov    %r14d,%esi
mov    %r14d,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r14
cmp    $0xffff,%r13
ja     1230 <main+0xe0>
mov    %r14d,%eax
mov    %bl,0x6(%rsp,%rax,1)
lea    0xdb1(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xb(%rsp),%rdi
lea    0x6(%rsp),%rdx
mov    %r15d,%esi
mov    %r14d,%ecx
call   1050 <multiplication@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"enter your operands:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"a[ %d ] = + %d * 256^%d\0A\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
@.str.4 = [25 x i8] c"b[ %d ] = + %d * 256^%d\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca [5 x i8]
%8 = alloca [5 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %5)
%12 = load i64, i64* %4
store i64 %12, i64* %6
br label %13
13: ; preds = %16, %0
%14 = load i64, i64* %6
%15 = icmp uge i64 %14, 256
br i1 %15, label %16, label %35
16: ; preds = %13
%17 = load i64, i64* %6
%18 = and i64 %17, 255
%19 = trunc i64 %18 to i8
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 %21
store i8 %19, i8* %22
%23 = load i64, i64* %6
%24 = lshr i64 %23, 8
store i64 %24, i64* %6
%25 = load i32, i32* %2
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i32, i32* %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %30, i32 %31)
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %13
35: ; preds = %13
%36 = load i64, i64* %6
%37 = trunc i64 %36 to i8
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 %39
store i8 %37, i8* %40
%41 = load i32, i32* %2
%42 = load i32, i32* %2
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = load i32, i32* %2
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %41, i32 %46, i32 %47)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%50 = load i64, i64* %5
store i64 %50, i64* %6
br label %51
51: ; preds = %54, %35
%52 = load i64, i64* %6
%53 = icmp uge i64 %52, 256
br i1 %53, label %54, label %73
54: ; preds = %51
%55 = load i64, i64* %6
%56 = and i64 %55, 255
%57 = trunc i64 %56 to i8
%58 = load i32, i32* %3
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 %59
store i8 %57, i8* %60
%61 = load i64, i64* %6
%62 = lshr i64 %61, 8
store i64 %62, i64* %6
%63 = load i32, i32* %3
%64 = load i32, i32* %3
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = load i32, i32* %3
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %63, i32 %68, i32 %69)
%71 = load i32, i32* %3
%72 = add nsw i32 %71, 1
store i32 %72, i32* %3
br label %51
73: ; preds = %51
%74 = load i64, i64* %6
%75 = trunc i64 %74 to i8
%76 = load i32, i32* %3
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 %77
store i8 %75, i8* %78
%79 = load i32, i32* %3
%80 = load i32, i32* %3
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = load i32, i32* %3
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %79, i32 %84, i32 %85)
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%88 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%89 = load i32, i32* %2
%90 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%91 = load i32, i32* %3
%92 = call i32 @multiplication(i8* %88, i32 %89, i8* %90, i32 %91)
ret i32 1
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"a[ %d ] = + %d * 256^%d\0A\00"
@.str.4 = [25 x i8] c"b[ %d ] = + %d * 256^%d\0A\00"
@str = [21 x i8] c"enter your operands:\00"
@str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca [5 x i8]
%4 = alloca [5 x i8]
%5 = bitcast i64* %1 to i8*
%6 = bitcast i64* %2 to i8*
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%12 = load i64, i64* %1
%13 = icmp ugt i64 %12, 255
br i1 %13, label %14, label %28
14: ; preds = %0, %14
%15 = phi i64 [ %24, %14 ], [ 0, %0 ]
%16 = phi i64 [ %19, %14 ], [ %12, %0 ]
%17 = trunc i64 %16 to i8
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 %15
store i8 %17, i8* %18
%19 = lshr i64 %16, 8
%20 = trunc i64 %16 to i32
%21 = and i32 %20, 255
%22 = trunc i64 %15 to i32
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %21, i32 %22)
%24 = add nuw nsw i64 %15, 1
%25 = icmp ugt i64 %16, 65535
br i1 %25, label %14, label %26
26: ; preds = %14
%27 = trunc i64 %24 to i32
br label %28
28: ; preds = %26, %0
%29 = phi i32 [ 0, %0 ], [ %27, %26 ]
%30 = phi i64 [ %12, %0 ], [ %19, %26 ]
%31 = trunc i64 %30 to i8
%32 = zext i32 %29 to i64
%33 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 %32
store i8 %31, i8* %33
%34 = trunc i64 %30 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %34, i32 %29)
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
%37 = load i64, i64* %2
%38 = icmp ugt i64 %37, 255
br i1 %38, label %39, label %53
39: ; preds = %28, %39
%40 = phi i64 [ %49, %39 ], [ 0, %28 ]
%41 = phi i64 [ %44, %39 ], [ %37, %28 ]
%42 = trunc i64 %41 to i8
%43 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %40
store i8 %42, i8* %43
%44 = lshr i64 %41, 8
%45 = trunc i64 %41 to i32
%46 = and i32 %45, 255
%47 = trunc i64 %40 to i32
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %47, i32 %46, i32 %47)
%49 = add nuw nsw i64 %40, 1
%50 = icmp ugt i64 %41, 65535
br i1 %50, label %39, label %51
51: ; preds = %39
%52 = trunc i64 %49 to i32
br label %53
53: ; preds = %51, %28
%54 = phi i32 [ 0, %28 ], [ %52, %51 ]
%55 = phi i64 [ %37, %28 ], [ %44, %51 ]
%56 = trunc i64 %55 to i8
%57 = zext i32 %54 to i64
%58 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %57
store i8 %56, i8* %58
%59 = trunc i64 %55 to i32
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %54, i32 %59, i32 %54)
%61 = call i32 @putchar(i32 10)
%62 = call i32 @multiplication(i8* %7, i32 %29, i8* %8, i32 %54)
ret i32 1
}