#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*/ free(int *);
int multiply(int *, int, int *, int);
int /*<<< orphan*/ printf(char *, int);
int *strToIntArray(char *, int);
int strlen(char *);
int main(int argc, char *argv[]) {
  int len1 = strlen(argv[1]);
  int len2 = strlen(argv[2]);
  int *n1 = strToIntArray(argv[1], len1);
  int *n2 = strToIntArray(argv[2], len2);
  int i, j;
  int product = multiply(n1, len1, n2, len2);
  printf("%d\n", product);
  free(n1);
  free(n2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1070 <strToIntArray@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x18(%rbp),%esi
call   1070 <strToIntArray@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%ecx
call   1040 <multiply@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xe32(%rip),%rdi
call   1060 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <strlen@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%rdi
mov    %r14d,%esi
call   1070 <strToIntArray@plt>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
mov    %ebp,%esi
call   1070 <strToIntArray@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14d,%esi
mov    %rax,%rdx
mov    %ebp,%ecx
call   1040 <multiply@plt>
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\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
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %7
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i32, i32* %6
%25 = call i32* @strToIntArray(i8* %23, i32 %24)
store i32* %25, i32** %8
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = load i32, i32* %7
%30 = call i32* @strToIntArray(i8* %28, i32 %29)
store i32* %30, i32** %9
%31 = load i32*, i32** %8
%32 = load i32, i32* %6
%33 = load i32*, i32** %9
%34 = load i32, i32* %7
%35 = call i32 @multiply(i32* %31, i32 %32, i32* %33, i32 %34)
store i32 %35, i32* %12
%36 = load i32, i32* %12
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = load i32*, i32** %8
%39 = call i32 @free(i32* %38)
%40 = load i32*, i32** %9
%41 = call i32 @free(i32* %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @strlen(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @strlen(i8* %7)
%9 = load i8*, i8** %3
%10 = tail call i32* @strToIntArray(i8* %9, i32 %5)
%11 = load i8*, i8** %6
%12 = tail call i32* @strToIntArray(i8* %11, i32 %8)
%13 = tail call i32 @multiply(i32* %10, i32 %5, i32* %12, i32 %8)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = tail call i32 @free(i32* %10)
%16 = tail call i32 @free(i32* %12)
ret i32 0
}