#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);
int main() {
  int a, b, c, d;
  a = 20;
  b = 10;
  c = 15;
  d = 5;
  printf("%d\n", a + b * c - a + b * d);
  printf("%d\n", a + (b * c) - a + (b * d));
  int e;
  e = (a + b) * c / d;
  printf("Valor de (a+b)*c/d = %d\n", e);
  e = ((a + b) * c) / d;
  printf("Valor de ((a+b)*c)/d = %d\n", e);
  e = (a + b) * (c / d);
  printf("Valor de (a+b)*(c/d) = %d\n", e);
  e = a + (b * c / d);
  printf("Valor de a+(b*c/d) = %d\n", e);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0xf,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
add    %eax,%esi
sub    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
imul   -0x14(%rbp),%eax
add    %eax,%esi
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
add    %eax,%esi
sub    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
imul   -0x14(%rbp),%eax
add    %eax,%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf33(%rip),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x5a,%esi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0x5a,%esi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x5a,%esi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x32,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [25 x i8] c"Valor de (a+b)*c/d = %d\0A\00"
@.str.2 = [27 x i8] c"Valor de ((a+b)*c)/d = %d\0A\00"
@.str.3 = [27 x i8] c"Valor de (a+b)*(c/d) = %d\0A\00"
@.str.4 = [25 x i8] c"Valor de a+(b*c/d) = %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
store i32 20, i32* %2
store i32 10, i32* %3
store i32 15, i32* %4
store i32 5, i32* %5
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = mul nsw i32 %8, %9
%11 = add nsw i32 %7, %10
%12 = load i32, i32* %2
%13 = sub nsw i32 %11, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = mul nsw i32 %14, %15
%17 = add nsw i32 %13, %16
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = mul nsw i32 %20, %21
%23 = add nsw i32 %19, %22
%24 = load i32, i32* %2
%25 = sub nsw i32 %23, %24
%26 = load i32, i32* %3
%27 = load i32, i32* %5
%28 = mul nsw i32 %26, %27
%29 = add nsw i32 %25, %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = add nsw i32 %31, %32
%34 = load i32, i32* %4
%35 = mul nsw i32 %33, %34
%36 = load i32, i32* %5
%37 = sdiv i32 %35, %36
store i32 %37, i32* %6
%38 = load i32, i32* %6
%39 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = add nsw i32 %40, %41
%43 = load i32, i32* %4
%44 = mul nsw i32 %42, %43
%45 = load i32, i32* %5
%46 = sdiv i32 %44, %45
store i32 %46, i32* %6
%47 = load i32, i32* %6
%48 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = add nsw i32 %49, %50
%52 = load i32, i32* %4
%53 = load i32, i32* %5
%54 = sdiv i32 %52, %53
%55 = mul nsw i32 %51, %54
store i32 %55, i32* %6
%56 = load i32, i32* %6
%57 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %2
%59 = load i32, i32* %3
%60 = load i32, i32* %4
%61 = mul nsw i32 %59, %60
%62 = load i32, i32* %5
%63 = sdiv i32 %61, %62
%64 = add nsw i32 %58, %63
store i32 %64, i32* %6
%65 = load i32, i32* %6
%66 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %65)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [25 x i8] c"Valor de (a+b)*c/d = %d\0A\00"
@.str.2 = [27 x i8] c"Valor de ((a+b)*c)/d = %d\0A\00"
@.str.3 = [27 x i8] c"Valor de (a+b)*(c/d) = %d\0A\00"
@.str.4 = [25 x i8] c"Valor de a+(b*c/d) = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 200)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 200)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 90)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 90)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 90)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 50)
ret i32 0
}