#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*/ codeln(char *);
int /*<<< orphan*/ commentln(char *);
int /*<<< orphan*/ popIndent();
int /*<<< orphan*/ pushIndent();
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
void t_cubic1(char *xs, char *ys) {
  char buf[512];
  commentln("Cubic function");
  codeln("{");
  pushIndent();
  sprintf(buf, "float e = 6.0 * %s;", xs);
  codeln(buf);
  codeln("if (e < 0.0) {");
  pushIndent();
  codeln("e = -e;");
  sprintf(buf, "%s = (e + e) - (e * e);", ys);
  codeln(buf);
  sprintf(buf, "%s = -%s;", ys, ys);
  codeln(buf);
  popIndent();
  codeln("} else {");
  pushIndent();
  sprintf(buf, "%s = (e + e) - (e * e);", ys);
  codeln(buf);
  popIndent();
  codeln("}");
  popIndent();
  codeln("}");
}


x86 assembly (clang, -O0):
<t_cubic1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe96(%rip),%rdi
call   1050 <commentln@plt>
lea    0xeba(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1030 <pushIndent@plt>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1040 <codeln@plt>
lea    0xe75(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1030 <pushIndent@plt>
lea    0xe71(%rip),%rdi
call   1040 <codeln@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe62(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1040 <codeln@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1060 <popIndent@plt>
lea    0xe3a(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1030 <pushIndent@plt>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xdfa(%rip),%rsi
mov    $0x0,%al
call   1070 <sprintf@plt>
lea    -0x210(%rbp),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1060 <popIndent@plt>
lea    0xe04(%rip),%rdi
call   1040 <codeln@plt>
mov    $0x0,%al
call   1060 <popIndent@plt>
lea    0xdf1(%rip),%rdi
call   1040 <codeln@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_cubic1>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe97(%rip),%rdi
call   1050 <commentln@plt>
lea    0xebb(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1030 <pushIndent@plt>
lea    0xe87(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <codeln@plt>
lea    0xe7c(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1030 <pushIndent@plt>
lea    0xe78(%rip),%rdi
call   1040 <codeln@plt>
lea    0xe74(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <codeln@plt>
lea    0xe6d(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1060 <popIndent@plt>
lea    0xe51(%rip),%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1030 <pushIndent@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1060 <popIndent@plt>
lea    0xe28(%rip),%rbx
mov    %rbx,%rdi
call   1040 <codeln@plt>
xor    %eax,%eax
call   1060 <popIndent@plt>
mov    %rbx,%rdi
call   1040 <codeln@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Cubic function\00"
@.str.1 = [2 x i8] c"{\00"
@.str.2 = [20 x i8] c"float e = 6.0 * %s;\00"
@.str.3 = [15 x i8] c"if (e < 0.0) {\00"
@.str.4 = [8 x i8] c"e = -e;\00"
@.str.5 = [24 x i8] c"%s = (e + e) - (e * e);\00"
@.str.6 = [10 x i8] c"%s = -%s;\00"
@.str.7 = [9 x i8] c"} else {\00"
@.str.8 = [2 x i8] c"}\00"
define void @t_cubic1(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [512 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i32 @commentln(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @pushIndent()
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%10 = load i8*, i8** %3
%11 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%13 = call i32 @codeln(i8* %12)
%14 = call i32 @codeln(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (...) @pushIndent()
%16 = call i32 @codeln(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%18 = load i8*, i8** %4
%19 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%21 = call i32 @codeln(i8* %20)
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%23 = load i8*, i8** %4
%24 = load i8*, i8** %4
%25 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %23, i8* %24)
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%27 = call i32 @codeln(i8* %26)
%28 = call i32 (...) @popIndent()
%29 = call i32 @codeln(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%30 = call i32 (...) @pushIndent()
%31 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%32 = load i8*, i8** %4
%33 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%35 = call i32 @codeln(i8* %34)
%36 = call i32 (...) @popIndent()
%37 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%38 = call i32 (...) @popIndent()
%39 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Cubic function\00"
@.str.1 = [2 x i8] c"{\00"
@.str.2 = [20 x i8] c"float e = 6.0 * %s;\00"
@.str.3 = [15 x i8] c"if (e < 0.0) {\00"
@.str.4 = [8 x i8] c"e = -e;\00"
@.str.5 = [24 x i8] c"%s = (e + e) - (e * e);\00"
@.str.6 = [10 x i8] c"%s = -%s;\00"
@.str.7 = [9 x i8] c"} else {\00"
@.str.8 = [2 x i8] c"}\00"
define void @t_cubic1(i8* %0, i8* %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @commentln(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (...) @pushIndent()
%8 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%9 = call i32 @codeln(i8* %4)
%10 = call i32 @codeln(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (...) @pushIndent()
%12 = call i32 @codeln(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%14 = call i32 @codeln(i8* %4)
%15 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %1, i8* %1)
%16 = call i32 @codeln(i8* %4)
%17 = call i32 (...) @popIndent()
%18 = call i32 @codeln(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 (...) @pushIndent()
%20 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%21 = call i32 @codeln(i8* %4)
%22 = call i32 (...) @popIndent()
%23 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%24 = call i32 (...) @popIndent()
%25 = call i32 @codeln(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
ret void
}