#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 */
struct arc {
  int dummy;
};

/* Variables and functions */
int count_sub_arc(struct arc *, double);
scalar_t__ error();
double *geo_sub_arc(struct arc *, int);
int render_sub_arc(struct arc *a, double **vaddr, double alpha) {
  int ndiv, npoint;
  double *verts;
  char message[255];
  npoint = count_sub_arc(a, alpha);
  if (error())
    return (0);
  ndiv = npoint - 1;
  verts = geo_sub_arc(a, npoint);
  if (error())
    return (0);
  *vaddr = verts;
  return (npoint);
}


x86 assembly (clang, -O0):
<render_sub_arc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1030 <count_sub_arc@plt>
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1050 <error@plt>
cmp    $0x0,%rax
je     1176 <render_sub_arc+0x46>
movl   $0x0,-0x4(%rbp)
jmp    11bd <render_sub_arc+0x8d>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1040 <geo_sub_arc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1050 <error@plt>
cmp    $0x0,%rax
je     11ac <render_sub_arc+0x7c>
movl   $0x0,-0x4(%rbp)
jmp    11bd <render_sub_arc+0x8d>
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_sub_arc>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <count_sub_arc@plt>
mov    %eax,%r15d
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <error@plt>
test   %rax,%rax
jne    1175 <render_sub_arc+0x45>
mov    %rbx,%rdi
mov    %r15d,%esi
call   1040 <geo_sub_arc@plt>
mov    %rax,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <error@plt>
test   %rax,%rax
jne    1175 <render_sub_arc+0x45>
mov    %rbx,(%r14)
mov    %r15d,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.arc = type { i32 }
define i32 @render_sub_arc(%struct.arc* %0, double** %1, double %2) {
%4 = alloca i32
%5 = alloca %struct.arc*
%6 = alloca double**
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca [255 x i8]
store %struct.arc* %0, %struct.arc** %5
store double** %1, double*** %6
store double %2, double* %7
%12 = load %struct.arc*, %struct.arc** %5
%13 = load double, double* %7
%14 = call i32 @count_sub_arc(%struct.arc* %12, double %13)
store i32 %14, i32* %9
%15 = call i64 (...) @error()
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 0, i32* %4
br label %31
18: ; preds = %3
%19 = load i32, i32* %9
%20 = sub nsw i32 %19, 1
store i32 %20, i32* %8
%21 = load %struct.arc*, %struct.arc** %5
%22 = load i32, i32* %9
%23 = call double* @geo_sub_arc(%struct.arc* %21, i32 %22)
store double* %23, double** %10
%24 = call i64 (...) @error()
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %18
store i32 0, i32* %4
br label %31
27: ; preds = %18
%28 = load double*, double** %10
%29 = load double**, double*** %6
store double* %28, double** %29
%30 = load i32, i32* %9
store i32 %30, i32* %4
br label %31
31: ; preds = %27, %26, %17
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
%struct.arc = type { i32 }
define i32 @render_sub_arc(%struct.arc* %0, double** nocapture writeonly %1, double %2) {
%4 = tail call i32 @count_sub_arc(%struct.arc* %0, double %2)
%5 = tail call i64 (...) @error()
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = tail call double* @geo_sub_arc(%struct.arc* %0, i32 %4)
%9 = tail call i64 (...) @error()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store double* %8, double** %1
br label %12
12: ; preds = %7, %3, %11
%13 = phi i32 [ %4, %11 ], [ 0, %3 ], [ 0, %7 ]
ret i32 %13
}