#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 getIntFromString(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char *a = malloc(10);
  char *b = malloc(10);
  strcpy(a, "12");
  strcpy(b, "2");
  printf("Mutliplying %s with %s and the product is %d", a, b,
         getIntFromString(a) * getIntFromString(b));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0xa,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0xa,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getIntFromString@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getIntFromString@plt>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
imul   %eax,%ecx
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0xa,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0xa,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1050 <getIntFromString@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <getIntFromString@plt>
imul   %eax,%ebp
lea    0xe6b(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %ebp,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"12\00"
@.str.1 = [2 x i8] c"2\00"
@.str.2 = [45 x i8] c"Mutliplying %s with %s and the product is %d\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @malloc(i32 10)
store i8* %3, i8** %1
%4 = call i8* @malloc(i32 10)
store i8* %4, i8** %2
%5 = load i8*, i8** %1
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %2
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %1
%10 = load i8*, i8** %2
%11 = load i8*, i8** %1
%12 = call i32 @getIntFromString(i8* %11)
%13 = load i8*, i8** %2
%14 = call i32 @getIntFromString(i8* %13)
%15 = mul nsw i32 %12, %14
%16 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %10, i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"12\00"
@.str.1 = [2 x i8] c"2\00"
@.str.2 = [45 x i8] c"Mutliplying %s with %s and the product is %d\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%2 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%3 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @getIntFromString(i8* %1)
%6 = tail call i32 @getIntFromString(i8* %2)
%7 = mul nsw i32 %6, %5
%8 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* %2, i32 %7)
ret i32 0
}