#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 from_bt(char const *);
int /*<<< orphan*/ mult(char const *, char *, char *);
int /*<<< orphan*/ printf(char *, char const *, int);
int /*<<< orphan*/ subtract(char *, char const *, char *);
int /*<<< orphan*/ to_bt(int, char *);
int main() {
  const char *a = "+-0++0+";
  char b[16];
  const char *c = "+-++-";
  char t[16];
  char d[16];
  to_bt(-436, b);
  subtract(b, c, t);
  mult(a, t, d);
  printf("      a: %14s %10d\n", a, from_bt(a));
  printf("      b: %14s %10d\n", b, from_bt(b));
  printf("      c: %14s %10d\n", c, from_bt(c));
  printf("a*(b-c): %14s %10d\n", d, from_bt(d));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe97(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0xfffffe4c,%edi
call   1050 <to_bt@plt>
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1060 <subtract@plt>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1040 <mult@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <from_bt@plt>
mov    -0x70(%rbp),%rsi
mov    %eax,%edx
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x20(%rbp),%rdi
call   1070 <from_bt@plt>
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <from_bt@plt>
mov    -0x60(%rbp),%rsi
mov    %eax,%edx
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
call   1070 <from_bt@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0x20(%rsp),%r12
mov    $0xfffffe4c,%edi
mov    %r12,%rsi
call   1050 <to_bt@plt>
lea    0xe92(%rip),%r15
lea    0x10(%rsp),%r13
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1060 <subtract@plt>
lea    0xe70(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1040 <mult@plt>
mov    %rbx,%rdi
call   1070 <from_bt@plt>
lea    0xe5e(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %r12,%rdi
call   1070 <from_bt@plt>
lea    0xe59(%rip),%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %r15,%rdi
call   1070 <from_bt@plt>
lea    0xe54(%rip),%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %r14,%rdi
call   1070 <from_bt@plt>
lea    0xe4f(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"+-0++0+\00"
@.str.1 = [6 x i8] c"+-++-\00"
@.str.2 = [20 x i8] c" a: %14s %10d\0A\00"
@.str.3 = [20 x i8] c" b: %14s %10d\0A\00"
@.str.4 = [20 x i8] c" c: %14s %10d\0A\00"
@.str.5 = [20 x i8] c"a*(b-c): %14s %10d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [16 x i8]
%4 = alloca i8*
%5 = alloca [16 x i8]
%6 = alloca [16 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %4
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = call i32 @to_bt(i32 -436, i8* %7)
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%12 = call i32 @subtract(i8* %9, i8* %10, i8* %11)
%13 = load i8*, i8** %2
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%16 = call i32 @mult(i8* %13, i8* %14, i8* %15)
%17 = load i8*, i8** %2
%18 = load i8*, i8** %2
%19 = call i32 @from_bt(i8* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %17, i32 %19)
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%23 = call i32 @from_bt(i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %21, i32 %23)
%25 = load i8*, i8** %4
%26 = load i8*, i8** %4
%27 = call i32 @from_bt(i8* %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %25, i32 %27)
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%31 = call i32 @from_bt(i8* %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %29, i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"+-0++0+\00"
@.str.1 = [6 x i8] c"+-++-\00"
@.str.2 = [20 x i8] c" a: %14s %10d\0A\00"
@.str.3 = [20 x i8] c" b: %14s %10d\0A\00"
@.str.4 = [20 x i8] c" c: %14s %10d\0A\00"
@.str.5 = [20 x i8] c"a*(b-c): %14s %10d\0A\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca [16 x i8]
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%7 = call i32 @to_bt(i32 -436, i8* %4)
%8 = call i32 @subtract(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%9 = call i32 @mult(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%10 = call i32 @from_bt(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @from_bt(i8* %4)
%13 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %4, i32 %12)
%14 = call i32 @from_bt(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i32 @from_bt(i8* %6)
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %6, i32 %16)
ret i32 0
}