#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(void) {
  int numbers[10], sum1[10], sub1[10];
  printf("Enter 1st number you want to add and subtract:\n");
  scanf("%9d", &numbers[0]);
  printf("Enter 2nd number you want to add and subtract:\n");
  scanf("%9d", &numbers[1]);
  sum1[1] = numbers[0] + numbers[1];
  printf("%9d + %9d = %9d\n", numbers[0], numbers[1], sum1[1]);
  sub1[1] = numbers[0] - numbers[1];
  printf("%9d - %9d = %9d\n", numbers[0], numbers[1], sub1[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xee5(%rip),%rdi
call   1040 <scanf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
add    $0x4,%rsi
lea    0xec3(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x5c(%rbp),%ecx
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
sub    -0x2c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x8c(%rbp),%ecx
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    (%rdx,%rsi,1),%ecx
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    %esi,%ecx
sub    %edx,%ecx
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Enter 1st number you want to add and subtract:\0A\00"
@.str.1 = [4 x i8] c"%9d\00"
@.str.2 = [48 x i8] c"Enter 2nd number you want to add and subtract:\0A\00"
@.str.3 = [17 x i8] c"%9d + %9d = %9d\0A\00"
@.str.4 = [17 x i8] c"%9d - %9d = %9d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca [10 x i32]
%4 = alloca [10 x i32]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %11
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%14 = load i32, i32* %13
%15 = add nsw i32 %12, %14
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
store i32 %15, i32* %16
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%18 = load i32, i32* %17
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%20 = load i32, i32* %19
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %18, i32 %20, i32 %22)
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%25 = load i32, i32* %24
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%27 = load i32, i32* %26
%28 = sub nsw i32 %25, %27
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 1
store i32 %28, i32* %29
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%31 = load i32, i32* %30
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%33 = load i32, i32* %32
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 1
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %33, i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%9d\00"
@.str.3 = [17 x i8] c"%9d + %9d = %9d\0A\00"
@.str.4 = [17 x i8] c"%9d - %9d = %9d\0A\00"
@str = [47 x i8] c"Enter 1st number you want to add and subtract:\00"
@str.5 = [47 x i8] c"Enter 2nd number you want to add and subtract:\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.5, i64 0, i64 0))
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = load i32, i32* %4
%10 = load i32, i32* %7
%11 = add nsw i32 %10, %9
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
%13 = load i32, i32* %4
%14 = load i32, i32* %7
%15 = sub nsw i32 %13, %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
ret i32 0
}