#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*/ areaOfRectangle(int, int, int *);
int /*<<< orphan*/ areaOfTriangle(int, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
main(void) {
  int l, w, aR;
  int b, h, aT;
  printf("Enter lenght and widh of rectangle\n");
  scanf("%d%d", &l, &w);
  areaOfRectangle(l, w, &aR);
  printf("Area of rectangle = %d\n", aR);
  printf("Enter base and height of triangle\n");
  scanf("%d%d", &b, &h);
  areaOfTriangle(b, h, &aT);
  printf("Area of triangle = %d\n", aT);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1060 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0xc(%rbp),%rdx
call   1050 <areaOfRectangle@plt>
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <scanf@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0x18(%rbp),%rdx
call   1040 <areaOfTriangle@plt>
mov    -0x18(%rbp),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rbx
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    0x1c(%rsp),%edi
mov    0x18(%rsp),%esi
lea    0x14(%rsp),%rdx
call   1060 <areaOfRectangle@plt>
mov    0x14(%rsp),%esi
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
lea    0x8(%rsp),%rdx
call   1050 <areaOfTriangle@plt>
mov    0x8(%rsp),%esi
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Enter lenght and widh of rectangle\0A\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [24 x i8] c"Area of rectangle = %d\0A\00"
@.str.3 = [35 x i8] c"Enter base and height of triangle\0A\00"
@.str.4 = [23 x i8] c"Area of triangle = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32 @areaOfRectangle(i32 %9, i32 %10, i32* %3)
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call i32 @areaOfTriangle(i32 %16, i32 %17, i32* %6)
%19 = load i32, i32* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [24 x i8] c"Area of rectangle = %d\0A\00"
@.str.4 = [23 x i8] c"Area of triangle = %d\0A\00"
@str = [35 x i8] c"Enter lenght and widh of rectangle\00"
@str.5 = [34 x i8] c"Enter base and height of triangle\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 @areaOfRectangle(i32 %15, i32 %16, i32* %3)
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.5, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 @areaOfTriangle(i32 %22, i32 %23, i32* %6)
%25 = load i32, i32* %6
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %25)
ret i32 0
}