#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*/ addmem(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int block_size = 0;
  int block_cnt = 0;
  while (1) {
    fprintf(stdout, "input block size and count: ");
    scanf("%d %d", &block_size, &block_cnt);
    addmem(block_size, block_cnt);
    fprintf(stdout, "waste mem: %d * %d = %d\n", block_size, block_cnt,
            block_size * block_cnt);
  }
  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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
lea    0xeab(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <addmem@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
imul   -0x18(%rbp),%r8d
mov    %r8d,-0x1c(%rbp)
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1154 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
mov    0x2e8f(%rip),%rbp
lea    0xea8(%rip),%r14
lea    0xebe(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%r13
lea    0xeb5(%rip),%rbx
xchg   %ax,%ax
mov    0x0(%rbp),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <addmem@plt>
mov    0x0(%rbp),%edi
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
mov    %ecx,%r8d
imul   %edx,%r8d
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1170 <main+0x40>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [29 x i8] c"input block size and count: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [25 x i8] c"waste mem: %d * %d = %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
store i32 0, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %2, %8
%9 = load i32, i32* @stdout
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @addmem(i32 %12, i32 %13)
%15 = load i32, i32* @stdout
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = mul nsw i32 %18, %19
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17, i32 %20)
br label %8
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [29 x i8] c"input block size and count: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [25 x i8] c"waste mem: %d * %d = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %7, %2
%8 = load i32, i32* @stdout
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @addmem(i32 %11, i32 %12)
%14 = load i32, i32* @stdout
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = mul nsw i32 %16, %15
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
br label %7
}