#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*/ add(int, int);
int mult(int, int /*<<< orphan*/);
int mult_a_sum(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int, ...);
int main(void) {
  typedef int myint;
  myint i = 7;
  myint j = 13;
  myint k = 42;
  typedef int *Foo[3];
  Foo foo = {&i, &j, &k};
  printf("%d + %d = %d\n", *foo[0], *foo[2], *foo[0] + *foo[2]);
  int *bar[3] = {&j, &k, &i};
  printf("%d + %d = %d\n", *bar[0], *bar[2], *bar[0] + *bar[2]);
  printf("%d*(%d + %d) = %d\n", k, i, j, mult(k, add(i, j)));
  printf("%d*(%d + %d) = %d\n", i, j, k, mult_a_sum(i, j, k));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
movl   $0xd,-0xc(%rbp)
movl   $0x2a,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
add    (%rax),%ecx
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x50(%rbp),%rax
mov    (%rax),%esi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
mov    -0x50(%rbp),%rax
mov    (%rax),%ecx
mov    -0x40(%rbp),%rax
add    (%rax),%ecx
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <add@plt>
mov    -0x6c(%rbp),%edi
mov    %eax,%esi
call   1050 <mult@plt>
mov    -0x68(%rbp),%esi
mov    -0x64(%rbp),%edx
mov    -0x60(%rbp),%ecx
mov    %eax,%r8d
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1060 <mult_a_sum@plt>
mov    -0x5c(%rbp),%esi
mov    -0x58(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    %eax,%r8d
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x2a,%edx
mov    $0x31,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
mov    $0x7,%edx
mov    $0x14,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7,%edi
mov    $0xd,%esi
call   1030 <add@plt>
mov    $0x2a,%edi
mov    %eax,%esi
call   1050 <mult@plt>
lea    0xe72(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    $0x7,%edx
mov    $0xd,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7,%edi
mov    $0xd,%esi
mov    $0x2a,%edx
call   1060 <mult_a_sum@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0xd,%edx
mov    $0x2a,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [19 x i8] c"%d*(%d + %d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [3 x i32*]
%6 = alloca [3 x i32*]
store i32 0, i32* %1
store i32 7, i32* %2
store i32 13, i32* %3
store i32 42, i32* %4
%7 = getelementptr inbounds [3 x i32*], [3 x i32*]* %5, i64 0, i64 0
store i32* %2, i32** %7
%8 = getelementptr inbounds i32*, i32** %7, i64 1
store i32* %3, i32** %8
%9 = getelementptr inbounds i32*, i32** %8, i64 1
store i32* %4, i32** %9
%10 = getelementptr inbounds [3 x i32*], [3 x i32*]* %5, i64 0, i64 0
%11 = load i32*, i32** %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds [3 x i32*], [3 x i32*]* %5, i64 0, i64 2
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = getelementptr inbounds [3 x i32*], [3 x i32*]* %5, i64 0, i64 0
%17 = load i32*, i32** %16
%18 = load i32, i32* %17
%19 = getelementptr inbounds [3 x i32*], [3 x i32*]* %5, i64 0, i64 2
%20 = load i32*, i32** %19
%21 = load i32, i32* %20
%22 = add nsw i32 %18, %21
%23 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %15, i32 %22)
%24 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 0
store i32* %3, i32** %24
%25 = getelementptr inbounds i32*, i32** %24, i64 1
store i32* %4, i32** %25
%26 = getelementptr inbounds i32*, i32** %25, i64 1
store i32* %2, i32** %26
%27 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 0
%28 = load i32*, i32** %27
%29 = load i32, i32* %28
%30 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 2
%31 = load i32*, i32** %30
%32 = load i32, i32* %31
%33 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 0
%34 = load i32*, i32** %33
%35 = load i32, i32* %34
%36 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 2
%37 = load i32*, i32** %36
%38 = load i32, i32* %37
%39 = add nsw i32 %35, %38
%40 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %32, i32 %39)
%41 = load i32, i32* %4
%42 = load i32, i32* %2
%43 = load i32, i32* %3
%44 = load i32, i32* %4
%45 = load i32, i32* %2
%46 = load i32, i32* %3
%47 = call i32 @add(i32 %45, i32 %46)
%48 = call i32 @mult(i32 %44, i32 %47)
%49 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %41, i32 %42, i32 %43, i32 %48)
%50 = load i32, i32* %2
%51 = load i32, i32* %3
%52 = load i32, i32* %4
%53 = load i32, i32* %2
%54 = load i32, i32* %3
%55 = load i32, i32* %4
%56 = call i32 @mult_a_sum(i32 %53, i32 %54, i32 %55)
%57 = call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %50, i32 %51, i32 %52, i32 %56)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [19 x i8] c"%d*(%d + %d) = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 7, i32 42, i32 49)
%2 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13, i32 7, i32 20)
%3 = tail call i32 @add(i32 7, i32 13)
%4 = tail call i32 @mult(i32 42, i32 %3)
%5 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 42, i32 7, i32 13, i32 %4)
%6 = tail call i32 @mult_a_sum(i32 7, i32 13, i32 42)
%7 = tail call i32 (i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 13, i32 42, i32 %6)
ret i32 0
}