#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 */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, long *, long *);
int main() {
  char *data;
  long m, n;
  printf("%s%c%c\n", "Content-Type:text/html;charset=utf-8", 13, 10);
  printf("<TITLE>Multiplication results</TITLE>\n");
  printf("<H3>Multiplication results</H3>\n");
  data = getenv("QUERY_STRING");
  if (data == NULL) {
    printf("<P>Error! Error in passing data from form to script.");
  } else if (sscanf(data, "v1=%ld&v2=%ld", &m, &n) != 2) {
    printf("<P>Error! Invalid data. Data must be numeric.");
  } else {
    printf("<P>The product of %ld and %ld is %ld.", m, n, m * n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xebb(%rip),%rsi
mov    $0xd,%edx
mov    $0xa,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a8 <main+0x78>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1200 <main+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xf04(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1050 <sscanf@plt>
cmp    $0x2,%eax
je     11dc <main+0xac>
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fb <main+0xcb>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
imul   -0x20(%rbp),%rcx
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1200 <main+0xd0>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xeb5(%rip),%rdi
lea    0xeb6(%rip),%rsi
mov    $0xd,%edx
mov    $0xa,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf67(%rip),%rdi
call   1040 <puts@plt>
lea    0xf81(%rip),%rdi
call   1040 <puts@plt>
lea    0xeab(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11cb <main+0x8b>
lea    0xedc(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rax,%rdi
call   1060 <sscanf@plt>
cmp    $0x2,%eax
jne    11d4 <main+0x94>
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %rdx,%rcx
imul   %rsi,%rcx
lea    0xee9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11e2 <main+0xa2>
lea    0xe68(%rip),%rdi
jmp    11db <main+0x9b>
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s%c%c\0A\00"
@.str.1 = [37 x i8] c"Content-Type:text/html;charset=utf-8\00"
@.str.2 = [39 x i8] c"<TITLE>Multiplication results</TITLE>\0A\00"
@.str.3 = [33 x i8] c"<H3>Multiplication results</H3>\0A\00"
@.str.4 = [13 x i8] c"QUERY_STRING\00"
@.str.5 = [53 x i8] c"<P>Error! Error in passing data from form to script.\00"
@.str.6 = [14 x i8] c"v1=%ld&v2=%ld\00"
@.str.7 = [46 x i8] c"<P>Error! Invalid data. Data must be numeric.\00"
@.str.8 = [38 x i8] c"<P>The product of %ld and %ld is %ld.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 13, i32 10)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%8 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i8* %8, i8** %2
%9 = load i8*, i8** %2
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0))
br label %27
13: ; preds = %0
%14 = load i8*, i8** %2
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i64* %3, i64* %4)
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0))
br label %26
19: ; preds = %13
%20 = load i64, i64* %3
%21 = load i64, i64* %4
%22 = load i64, i64* %3
%23 = load i64, i64* %4
%24 = mul nsw i64 %22, %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i64 %20, i64 %21, i64 %24)
br label %26
26: ; preds = %19, %17
br label %27
27: ; preds = %26, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s%c%c\0A\00"
@.str.1 = [37 x i8] c"Content-Type:text/html;charset=utf-8\00"
@.str.4 = [13 x i8] c"QUERY_STRING\00"
@.str.5 = [53 x i8] c"<P>Error! Error in passing data from form to script.\00"
@.str.6 = [14 x i8] c"v1=%ld&v2=%ld\00"
@.str.7 = [46 x i8] c"<P>Error! Invalid data. Data must be numeric.\00"
@.str.8 = [38 x i8] c"<P>The product of %ld and %ld is %ld.\00"
@str = [38 x i8] c"<TITLE>Multiplication results</TITLE>\00"
@str.9 = [32 x i8] c"<H3>Multiplication results</H3>\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 13, i32 10)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
%8 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0))
br label %22
12: ; preds = %0
%13 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i64* %1, i64* %2)
%14 = icmp eq i32 %13, 2
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0))
br label %22
17: ; preds = %12
%18 = load i64, i64* %1
%19 = load i64, i64* %2
%20 = mul nsw i64 %19, %18
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i64 %18, i64 %19, i64 %20)
br label %22
22: ; preds = %15, %17, %10
ret i32 0
}