#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 *carga_numero();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int *a = carga_numero();
  int *b = carga_numero();
  int *c = carga_numero();
  int suma = *a + *b + *c;
  int producto = *a * *b * *c;
  printf("Suma: %d\n", suma);
  printf("Producto: %d\n", producto);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <carga_numero@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <carga_numero@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <carga_numero@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
add    (%rcx),%eax
mov    -0x20(%rbp),%rcx
add    (%rcx),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
imul   (%rcx),%eax
mov    -0x20(%rbp),%rcx
imul   (%rcx),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <carga_numero@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1040 <carga_numero@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <carga_numero@plt>
mov    (%r14),%ecx
mov    (%rbx),%ebx
lea    (%rbx,%rcx,1),%esi
mov    (%rax),%eax
add    %eax,%esi
imul   %ecx,%ebx
imul   %eax,%ebx
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Suma: %d\0A\00"
@.str.1 = [14 x i8] c"Producto: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32* (...) @carga_numero()
store i32* %7, i32** %2
%8 = call i32* (...) @carga_numero()
store i32* %8, i32** %3
%9 = call i32* (...) @carga_numero()
store i32* %9, i32** %4
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = load i32*, i32** %3
%13 = load i32, i32* %12
%14 = add nsw i32 %11, %13
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = add nsw i32 %14, %16
store i32 %17, i32* %5
%18 = load i32*, i32** %2
%19 = load i32, i32* %18
%20 = load i32*, i32** %3
%21 = load i32, i32* %20
%22 = mul nsw i32 %19, %21
%23 = load i32*, i32** %4
%24 = load i32, i32* %23
%25 = mul nsw i32 %22, %24
store i32 %25, i32* %6
%26 = load i32, i32* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %6
%29 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Suma: %d\0A\00"
@.str.1 = [14 x i8] c"Producto: %d\0A\00"
define i32 @main() {
%1 = tail call i32* (...) @carga_numero()
%2 = tail call i32* (...) @carga_numero()
%3 = tail call i32* (...) @carga_numero()
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = add nsw i32 %5, %4
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = mul nsw i32 %5, %4
%10 = mul nsw i32 %9, %7
%11 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}