#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*/ flushall();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int age;
  long total_beats;
  printf(
      "Please enter your age to find out how many beats your heart has made: ");
  scanf("%d", &age);
  flushall();
  total_beats = 39446175 * age;
  printf("Your heart has beated %d times in your %d years of life", total_beats,
         age);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1040 <flushall@plt>
imul   $0x259e69f,-0x4(%rbp),%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1040 <flushall@plt>
movslq 0x4(%rsp),%rdx
imul   $0x259e69f,%rdx,%rsi
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [71 x i8] c"Please enter your age to find out how many beats your heart has made: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [56 x i8] c"Your heart has beated %d times in your %d years of life\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 (...) @flushall()
%6 = load i32, i32* %1
%7 = mul nsw i32 39446175, %6
%8 = sext i32 %7 to i64
store i64 %8, i64* %2
%9 = load i64, i64* %2
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i64 %9, i32 %10)
%12 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [71 x i8] c"Please enter your age to find out how many beats your heart has made: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [56 x i8] c"Your heart has beated %d times in your %d years of life\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 (...) @flushall()
%6 = load i32, i32* %1
%7 = mul nsw i32 %6, 39446175
%8 = sext i32 %7 to i64
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i64 %8, i32 %6)
%10 = call i32 (...) @getchar()
ret i32 0
}