#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 mul(int, int);
int /*<<< orphan*/ printf(char *, int, int, ...);
int main(int argc, char **argv) {
  int a, b;
  if (argc == 3) {
    a = atoi(argv[1]);
    b = atoi(argv[2]);
    printf("%d * %d = %d (expected %d)\n", a, b, mul(a, b), a * b);
  }
  printf("5 * 2 = %d (expected %d)\n", mul(5, 2), 5 * 2);
  printf("-155 * 2 = %d (expected %d)\n", mul(-155, 13), -155 * 13);
  printf("26981 * 49853 = %d (expected %d)\n", mul(26981, 49853),
         26981 * 49853);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11a6 <main+0x76>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <mul@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
mov    -0x14(%rbp),%r8d
imul   -0x18(%rbp),%r8d
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0x2,%esi
call   1040 <mul@plt>
mov    %eax,%esi
lea    0xe61(%rip),%rdi
mov    $0xa,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffff65,%edi
mov    $0xd,%esi
call   1040 <mul@plt>
mov    %eax,%esi
lea    0xe3a(%rip),%rdi
mov    $0xfffff821,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x6965,%edi
mov    $0xc2bd,%esi
call   1040 <mul@plt>
mov    %eax,%esi
lea    0xe33(%rip),%rdi
mov    $0x502c5991,%edx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1175 <main+0x45>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <mul@plt>
mov    %ebx,%r8d
imul   %ebp,%r8d
lea    0xe98(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0x2,%esi
call   1040 <mul@plt>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffff65,%edi
mov    $0xd,%esi
call   1040 <mul@plt>
lea    0xe6d(%rip),%rdi
mov    %eax,%esi
mov    $0xfffff821,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x6965,%edi
mov    $0xc2bd,%esi
call   1040 <mul@plt>
lea    0xe66(%rip),%rdi
mov    %eax,%esi
mov    $0x502c5991,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"%d * %d = %d (expected %d)\0A\00"
@.str.1 = [26 x i8] c"5 * 2 = %d (expected %d)\0A\00"
@.str.2 = [29 x i8] c"-155 * 2 = %d (expected %d)\0A\00"
@.str.3 = [34 x i8] c"26981 * 49853 = %d (expected %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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %28
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %7
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = call i32 @mul(i32 %21, i32 %22)
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = mul nsw i32 %24, %25
%27 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i32 %23, i32 %26)
br label %28
28: ; preds = %10, %2
%29 = call i32 @mul(i32 5, i32 2)
%30 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 10)
%31 = call i32 @mul(i32 -155, i32 13)
%32 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 -2015)
%33 = call i32 @mul(i32 26981, i32 49853)
%34 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %33, i32 1345083793)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"%d * %d = %d (expected %d)\0A\00"
@.str.1 = [26 x i8] c"5 * 2 = %d (expected %d)\0A\00"
@.str.2 = [29 x i8] c"-155 * 2 = %d (expected %d)\0A\00"
@.str.3 = [34 x i8] c"26981 * 49853 = %d (expected %d)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = tail call i32 @mul(i32 %7, i32 %10)
%12 = mul nsw i32 %10, %7
%13 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 %11, i32 %12)
br label %14
14: ; preds = %4, %2
%15 = tail call i32 @mul(i32 5, i32 2)
%16 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 10)
%17 = tail call i32 @mul(i32 -155, i32 13)
%18 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 -2015)
%19 = tail call i32 @mul(i32 26981, i32 49853)
%20 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %19, i32 1345083793)
ret i32 0
}