#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 atoi(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int MultiplicaEZ(char m1[], char m2[]) {
  char subm1[5];
  strncpy(subm1, m1, 4);
  subm1[4] = '\0';
  char subm2[5];
  strncpy(subm2, m2, 4);
  subm2[4] = '\0';
  int im1 = atoi(subm1);
  int im2 = atoi(subm2);
  return (im1 * im2);
}


x86 assembly (clang, -O0):
<MultiplicaEZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x15(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x16(%rbp)
lea    -0x15(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x20(%rbp)
lea    -0x1a(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
imul   -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MultiplicaEZ>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xb(%rsp),%r14
mov    %r14,%rdi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xf(%rsp)
lea    0x6(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xa(%rsp)
mov    %r14,%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1040 <atoi@plt>
imul   %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @MultiplicaEZ(i8* %0, i8* %1) {
%3 = alloca [5 x i8]
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%6 = call i32 @strncpy(i8* %5, i8* %0, i32 4)
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
store i8 0, i8* %7
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%9 = call i32 @strncpy(i8* %8, i8* %1, i32 4)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 4
store i8 0, i8* %10
%11 = call i32 @atoi(i8* %5)
%12 = call i32 @atoi(i8* %8)
%13 = mul nsw i32 %12, %11
ret i32 %13
}