#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(unsigned char *);
unsigned char *malloc(int);
int /*<<< orphan*/ modprod(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ printresult(unsigned char *, unsigned char *,
                               unsigned char *);
int /*<<< orphan*/ strToHex(char *, unsigned char *, char *, unsigned char *);
int modproduct(char p1[8], char p2[8]) {
  unsigned char a[4];
  unsigned char b[4];
  unsigned char *result = malloc(sizeof(unsigned char) * 4);
  strToHex(p1, a, p2, b);
  modprod(a, b, result);
  printresult(a, b, result);
  free(result);
  return 0;
}


x86 assembly (clang, -O0):
<modproduct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1060 <strToHex@plt>
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <modprod@plt>
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <printresult@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modproduct>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x4,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r13,%rcx
call   1060 <strToHex@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <modprod@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1040 <printresult@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @modproduct(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [4 x i8]
%6 = alloca [4 x i8]
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = call i8* @malloc(i32 4)
store i8* %8, i8** %7
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%11 = load i8*, i8** %4
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%13 = call i32 @strToHex(i8* %9, i8* %10, i8* %11, i8* %12)
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%16 = load i8*, i8** %7
%17 = call i32 @modprod(i8* %14, i8* %15, i8* %16)
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%20 = load i8*, i8** %7
%21 = call i32 @printresult(i8* %18, i8* %19, i8* %20)
%22 = load i8*, i8** %7
%23 = call i32 @free(i8* %22)
ret i32 0
}

LLVM IR (-O2):
define i32 @modproduct(i8* %0, i8* %1) {
%3 = alloca [4 x i8]
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%7 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%8 = call i32 @strToHex(i8* %0, i8* %5, i8* %1, i8* %6)
%9 = call i32 @modprod(i8* %5, i8* %6, i8* %7)
%10 = call i32 @printresult(i8* %5, i8* %6, i8* %7)
%11 = call i32 @free(i8* %7)
ret i32 0
}