#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 */
float f(float, float, float);
float h(float, float);
int /*<<< orphan*/ putchar(char);
float sqrtf(float);
int main() {
  for (float z = 1.5f; z > -1.5f; z -= 0.05f) {
    for (float x = -1.5f; x < 1.5f; x += 0.025f) {
      float v = f(x, 0.0f, z);
      if (v <= 0.0f) {
        float y0 = h(x, z);
        float ny = 0.01f;
        float nx = h(x + ny, z) - y0;
        float nz = h(x, z + ny) - y0;
        float nd = 1.0f / sqrtf(nx * nx + ny * ny + nz * nz);
        float d = (nx + ny - nz) * nd * 0.5f + 0.5f;
        putchar(".:-=+*#%@"[(int)(d * 5.0f)]);
      } else
        putchar(' ');
    }
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xea9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xe9b(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    12f6 <main+0x1b6>
movss  0xe8a(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe79(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    12d1 <main+0x191>
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
xorps  %xmm1,%xmm1
call   1050 <f@plt>
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     12ab <main+0x16b>
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <h@plt>
movss  %xmm0,-0x14(%rbp)
movss  0xe47(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <h@plt>
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
addss  -0x18(%rbp),%xmm1
call   1040 <h@plt>
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1060 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  0xdc4(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
subss  -0x20(%rbp),%xmm0
mulss  -0x24(%rbp),%xmm0
movss  0xd9b(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  0xd82(%rip),%xmm0
mulss  -0x28(%rbp),%xmm0
cvttss2si %xmm0,%eax
movslq %eax,%rcx
lea    0xd83(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    12b5 <main+0x175>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    12ba <main+0x17a>
movss  0xd5a(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    117f <main+0x3f>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  -0x8(%rbp),%xmm0
movss  0xd20(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    115c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movss  0xeb3(%rip),%xmm0
movss  0xeb3(%rip),%xmm1
lea    0xecc(%rip),%rbx
jmp    1189 <main+0x49>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x10(%rsp),%xmm0
addss  0xea8(%rip),%xmm0
movss  0xe88(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    12d9 <main+0x199>
movss  %xmm0,0x10(%rsp)
addss  0xe6d(%rip),%xmm0
movss  %xmm0,0x1c(%rsp)
movaps %xmm1,%xmm0
jmp    122f <main+0xef>
cs nopw 0x0(%rax,%rax,1)
nop
movss  %xmm3,0xc(%rsp)
call   1060 <sqrtf@plt>
movss  0xc(%rsp),%xmm3
movss  0x18(%rsp),%xmm2
movss  0xe41(%rip),%xmm1
divss  %xmm0,%xmm1
addss  0xe29(%rip),%xmm2
subss  %xmm3,%xmm2
mulss  %xmm1,%xmm2
movss  0xe29(%rip),%xmm0
mulss  %xmm0,%xmm2
addss  %xmm0,%xmm2
mulss  0xe1d(%rip),%xmm2
cvttss2si %xmm2,%eax
cltq
movzbl (%rax,%rbx,1),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
movss  0x14(%rsp),%xmm1
addss  0xe01(%rip),%xmm1
movss  0xddd(%rip),%xmm0
ucomiss %xmm1,%xmm0
movaps %xmm1,%xmm0
jbe    1160 <main+0x20>
movss  %xmm0,0x14(%rsp)
xorps  %xmm1,%xmm1
movss  0x10(%rsp),%xmm2
call   1050 <f@plt>
mov    $0x20,%al
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jb     1205 <main+0xc5>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1040 <h@plt>
movss  %xmm0,0xc(%rsp)
movss  0x14(%rsp),%xmm0
addss  0xd92(%rip),%xmm0
movss  0x10(%rsp),%xmm1
call   1040 <h@plt>
subss  0xc(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
movss  0x14(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
call   1040 <h@plt>
movss  0x18(%rsp),%xmm2
movaps %xmm0,%xmm3
subss  0xc(%rsp),%xmm3
movaps %xmm2,%xmm1
mulss  %xmm2,%xmm1
addss  0xd54(%rip),%xmm1
movaps %xmm3,%xmm0
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
ucomiss 0xd5a(%rip),%xmm0
jb     11b0 <main+0x70>
sqrtss %xmm0,%xmm0
jmp    11c7 <main+0x87>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c".:-=+*#%@\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store i32 0, i32* %1
store float 1.500000e+00, float* %2
br label %11
11: ; preds = %76, %0
%12 = load float, float* %2
%13 = fcmp ogt float %12, -1.500000e+00
br i1 %13, label %14, label %79
14: ; preds = %11
store float -1.500000e+00, float* %3
br label %15
15: ; preds = %71, %14
%16 = load float, float* %3
%17 = fcmp olt float %16, 1.500000e+00
br i1 %17, label %18, label %74
18: ; preds = %15
%19 = load float, float* %3
%20 = load float, float* %2
%21 = call float @f(float %19, float 0.000000e+00, float %20)
store float %21, float* %4
%22 = load float, float* %4
%23 = fcmp ole float %22, 0.000000e+00
br i1 %23, label %24, label %68
24: ; preds = %18
%25 = load float, float* %3
%26 = load float, float* %2
%27 = call float @h(float %25, float %26)
store float %27, float* %5
store float 0x3F847AE140000000, float* %6
%28 = load float, float* %3
%29 = load float, float* %6
%30 = fadd float %28, %29
%31 = load float, float* %2
%32 = call float @h(float %30, float %31)
%33 = load float, float* %5
%34 = fsub float %32, %33
store float %34, float* %7
%35 = load float, float* %3
%36 = load float, float* %2
%37 = load float, float* %6
%38 = fadd float %36, %37
%39 = call float @h(float %35, float %38)
%40 = load float, float* %5
%41 = fsub float %39, %40
store float %41, float* %8
%42 = load float, float* %7
%43 = load float, float* %7
%44 = load float, float* %6
%45 = load float, float* %6
%46 = fmul float %44, %45
%47 = call float @llvm.fmuladd.f32(float %42, float %43, float %46)
%48 = load float, float* %8
%49 = load float, float* %8
%50 = call float @llvm.fmuladd.f32(float %48, float %49, float %47)
%51 = call float @sqrtf(float %50)
%52 = fdiv float 1.000000e+00, %51
store float %52, float* %9
%53 = load float, float* %7
%54 = load float, float* %6
%55 = fadd float %53, %54
%56 = load float, float* %8
%57 = fsub float %55, %56
%58 = load float, float* %9
%59 = fmul float %57, %58
%60 = call float @llvm.fmuladd.f32(float %59, float 5.000000e-01, float 5.000000e-01)
store float %60, float* %10
%61 = load float, float* %10
%62 = fmul float %61, 5.000000e+00
%63 = fptosi float %62 to i32
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [10 x i8], [10 x i8]* @.str, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = call i32 @putchar(i8 signext %66)
br label %70
68: ; preds = %18
%69 = call i32 @putchar(i8 signext 32)
br label %70
70: ; preds = %68, %24
br label %71
71: ; preds = %70
%72 = load float, float* %3
%73 = fadd float %72, 0x3F999999A0000000
store float %73, float* %3
br label %15
74: ; preds = %15
%75 = call i32 @putchar(i8 signext 10)
br label %76
76: ; preds = %74
%77 = load float, float* %2
%78 = fsub float %77, 0x3FA99999A0000000
store float %78, float* %2
br label %11
79: ; preds = %11
%80 = load i32, i32* %1
ret i32 %80
}

LLVM IR (-O2):
@.str = [10 x i8] c".:-=+*#%@\00"
define i32 @main() {
br label %1
1: ; preds = %0, %5
%2 = phi float [ 1.500000e+00, %0 ], [ %7, %5 ]
%3 = fadd float %2, 0x3F847AE140000000
br label %9
4: ; preds = %5
ret i32 0
5: ; preds = %33
%6 = tail call i32 @putchar(i8 signext 10)
%7 = fadd float %2, 0xBFA99999A0000000
%8 = fcmp ogt float %7, -1.500000e+00
br i1 %8, label %1, label %4
9: ; preds = %1, %33
%10 = phi float [ -1.500000e+00, %1 ], [ %36, %33 ]
%11 = tail call float @f(float %10, float 0.000000e+00, float %2)
%12 = fcmp ugt float %11, 0.000000e+00
br i1 %12, label %33, label %13
13: ; preds = %9
%14 = tail call float @h(float %10, float %2)
%15 = fadd float %10, 0x3F847AE140000000
%16 = tail call float @h(float %15, float %2)
%17 = fsub float %16, %14
%18 = tail call float @h(float %10, float %3)
%19 = fsub float %18, %14
%20 = tail call float @llvm.fmuladd.f32(float %17, float %17, float 0x3F1A36E2E0000000)
%21 = tail call float @llvm.fmuladd.f32(float %19, float %19, float %20)
%22 = tail call float @sqrtf(float %21)
%23 = fdiv float 1.000000e+00, %22
%24 = fadd float %17, 0x3F847AE140000000
%25 = fsub float %24, %19
%26 = fmul float %25, %23
%27 = tail call float @llvm.fmuladd.f32(float %26, float 5.000000e-01, float 5.000000e-01)
%28 = fmul float %27, 5.000000e+00
%29 = fptosi float %28 to i32
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i8], [10 x i8]* @.str, i64 0, i64 %30
%32 = load i8, i8* %31
br label %33
33: ; preds = %9, %13
%34 = phi i8 [ %32, %13 ], [ 32, %9 ]
%35 = tail call i32 @putchar(i8 signext %34)
%36 = fadd float %10, 0x3F999999A0000000
%37 = fcmp olt float %36, 1.500000e+00
br i1 %37, label %9, label %5
}