#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  printf("This program needs 3 initial digit(s) to provide different "
         "calculations:\n\n");
  int a, b, c;
  printf("Please enter 1st number: ");
  scanf("%d", &a);
  printf("Please enter 2nd number: ");
  scanf("%d", &b);
  printf("Please enter 3rd number: ");
  scanf("%d", &c);
  printf("\nPay attention to below results:\n");
  printf("Summation of these 3 numbers result is: %d\n", a + b + c);
  printf("Differences between 1st and 2nd is: %d\n", b - a);
  printf("Differences between 1st and 3rd is: %d\n", c - a);
  printf("2nd number multiply by 3rd number result is: %d\n", b * c);
  printf("Product of these 3 numbers is: %d\n", a * b * c);
  printf("E= 2AB+A-B %d\n", 2 * a * b + a - b);
  printf("F= A+B+10-4AB %d\n", a + b + 10 - (4 * a * b));
  printf("G= AB-2(A+B) %d\n", a * b - 2 * (a + b));
  printf("H= 2A+2B-2AB %d\n", 2 * a + 2 * b - (2 * a * b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
add    -0x10(%rbp),%esi
lea    0xf09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
sub    -0x8(%rbp),%esi
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
sub    -0x8(%rbp),%esi
lea    0xf35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
imul   -0x10(%rbp),%esi
lea    0xf48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
imul   -0x10(%rbp),%esi
lea    0xf60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
imul   -0xc(%rbp),%esi
add    -0x8(%rbp),%esi
sub    -0xc(%rbp),%esi
lea    0xf65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
add    $0xa,%esi
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
imul   -0xc(%rbp),%eax
sub    %eax,%esi
lea    0xf51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    %eax,%esi
lea    0xf43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    %eax,%esi
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
imul   -0xc(%rbp),%eax
sub    %eax,%esi
lea    0xf2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x1028(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec4(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x100e(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
add    0x8(%rsp),%esi
add    0xc(%rsp),%esi
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
sub    0x8(%rsp),%esi
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
sub    0x8(%rsp),%esi
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
imul   0x4(%rsp),%esi
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
imul   0x8(%rsp),%esi
imul   0xc(%rsp),%esi
lea    0xee7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
mov    0x4(%rsp),%ecx
mov    %eax,%edx
imul   %ecx,%edx
sub    %ecx,%eax
lea    (%rax,%rdx,2),%esi
lea    0xeea(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%eax
mov    %esi,%ecx
imul   %eax,%ecx
shl    $0x2,%ecx
add    %eax,%esi
sub    %ecx,%esi
add    $0xa,%esi
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
mov    0x4(%rsp),%ecx
mov    %ecx,%esi
imul   %eax,%esi
add    %eax,%ecx
add    %ecx,%ecx
sub    %ecx,%esi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
mov    0x4(%rsp),%ecx
lea    (%rcx,%rax,1),%esi
imul   %eax,%ecx
sub    %ecx,%esi
add    %esi,%esi
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [75 x i8] c"This program needs 3 initial digit(s) to provide different calculations:\0A\0A\00"
@.str.1 = [26 x i8] c"Please enter 1st number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [26 x i8] c"Please enter 2nd number: \00"
@.str.4 = [26 x i8] c"Please enter 3rd number: \00"
@.str.5 = [34 x i8] c"\0APay attention to below results:\0A\00"
@.str.6 = [44 x i8] c"Summation of these 3 numbers result is: %d\0A\00"
@.str.7 = [40 x i8] c"Differences between 1st and 2nd is: %d\0A\00"
@.str.8 = [40 x i8] c"Differences between 1st and 3rd is: %d\0A\00"
@.str.9 = [49 x i8] c"2nd number multiply by 3rd number result is: %d\0A\00"
@.str.10 = [35 x i8] c"Product of these 3 numbers is: %d\0A\00"
@.str.11 = [15 x i8] c"E= 2AB+A-B %d\0A\00"
@.str.12 = [18 x i8] c"F= A+B+10-4AB %d\0A\00"
@.str.13 = [17 x i8] c"G= AB-2(A+B) %d\0A\00"
@.str.14 = [17 x i8] c"H= 2A+2B-2AB %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = add nsw i32 %13, %14
%16 = load i32, i32* %4
%17 = add nsw i32 %15, %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = sub nsw i32 %19, %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %4
%24 = load i32, i32* %2
%25 = sub nsw i32 %23, %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = mul nsw i32 %27, %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = mul nsw i32 %31, %32
%34 = load i32, i32* %4
%35 = mul nsw i32 %33, %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %2
%38 = mul nsw i32 2, %37
%39 = load i32, i32* %3
%40 = mul nsw i32 %38, %39
%41 = load i32, i32* %2
%42 = add nsw i32 %40, %41
%43 = load i32, i32* %3
%44 = sub nsw i32 %42, %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = add nsw i32 %46, %47
%49 = add nsw i32 %48, 10
%50 = load i32, i32* %2
%51 = mul nsw i32 4, %50
%52 = load i32, i32* %3
%53 = mul nsw i32 %51, %52
%54 = sub nsw i32 %49, %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %2
%57 = load i32, i32* %3
%58 = mul nsw i32 %56, %57
%59 = load i32, i32* %2
%60 = load i32, i32* %3
%61 = add nsw i32 %59, %60
%62 = mul nsw i32 2, %61
%63 = sub nsw i32 %58, %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i32 %63)
%65 = load i32, i32* %2
%66 = mul nsw i32 2, %65
%67 = load i32, i32* %3
%68 = mul nsw i32 2, %67
%69 = add nsw i32 %66, %68
%70 = load i32, i32* %2
%71 = mul nsw i32 2, %70
%72 = load i32, i32* %3
%73 = mul nsw i32 %71, %72
%74 = sub nsw i32 %69, %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i32 %74)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"Please enter 1st number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [26 x i8] c"Please enter 2nd number: \00"
@.str.4 = [26 x i8] c"Please enter 3rd number: \00"
@.str.6 = [44 x i8] c"Summation of these 3 numbers result is: %d\0A\00"
@.str.7 = [40 x i8] c"Differences between 1st and 2nd is: %d\0A\00"
@.str.8 = [40 x i8] c"Differences between 1st and 3rd is: %d\0A\00"
@.str.9 = [49 x i8] c"2nd number multiply by 3rd number result is: %d\0A\00"
@.str.10 = [35 x i8] c"Product of these 3 numbers is: %d\0A\00"
@.str.11 = [15 x i8] c"E= 2AB+A-B %d\0A\00"
@.str.12 = [18 x i8] c"F= A+B+10-4AB %d\0A\00"
@.str.13 = [17 x i8] c"G= AB-2(A+B) %d\0A\00"
@.str.14 = [17 x i8] c"H= 2A+2B-2AB %d\0A\00"
@str = [74 x i8] c"This program needs 3 initial digit(s) to provide different calculations:\0A\00"
@str.15 = [33 x i8] c"\0APay attention to below results:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.15, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = add nsw i32 %16, %15
%18 = load i32, i32* %3
%19 = add nsw i32 %17, %18
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %2
%22 = load i32, i32* %1
%23 = sub nsw i32 %21, %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %1
%27 = sub nsw i32 %25, %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = mul nsw i32 %30, %29
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %1
%34 = load i32, i32* %2
%35 = mul nsw i32 %34, %33
%36 = load i32, i32* %3
%37 = mul nsw i32 %35, %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %1
%40 = shl nsw i32 %39, 1
%41 = load i32, i32* %2
%42 = mul nsw i32 %40, %41
%43 = sub i32 %39, %41
%44 = add i32 %43, %42
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %1
%47 = load i32, i32* %2
%48 = mul i32 %46, -4
%49 = mul i32 %48, %47
%50 = add i32 %46, 10
%51 = add i32 %50, %47
%52 = add i32 %51, %49
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %1
%55 = load i32, i32* %2
%56 = mul nsw i32 %55, %54
%57 = add nsw i32 %55, %54
%58 = mul i32 %57, -2
%59 = add i32 %58, %56
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %1
%62 = load i32, i32* %2
%63 = add nsw i32 %62, %61
%64 = mul i32 %62, %61
%65 = sub i32 %63, %64
%66 = shl i32 %65, 1
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i32 %66)
ret i32 0
}