#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 convex_hull_2d(int, char *, int *, char *);
int /*<<< orphan*/ printf(char *, ...);
int planar_hull(int nbc_pts, char *pts) {
  int fail, nbc_hull;
  char hull[10 * nbc_pts];
  fail = convex_hull_2d(nbc_pts, pts, &nbc_hull, hull);
  printf("Vertices and inner normals of the convex hull :\n");
  hull[nbc_hull] = '\0';
  printf("%s\n", hull);
}


x86 assembly (clang, -O0):
<planar_hull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
add    %ecx,%ecx
mov    %ecx,%eax
lea    (%rax,%rax,4),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <convex_hull_2d@plt>
mov    %eax,-0x14(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rsi
movslq -0x18(%rbp),%rax
movb   $0x0,(%rsi,%rax,1)
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<planar_hull>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%r14
lea    (%rdi,%rdi,1),%eax
lea    (%rax,%rax,4),%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x14(%rbp),%rdx
mov    %rbx,%rcx
call   1030 <convex_hull_2d@plt>
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
movslq -0x14(%rbp),%rax
movb   $0x0,(%rax,%rbx,1)
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rsp
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Vertices and inner normals of the convex hull :\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @planar_hull(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
%10 = load i32, i32* %4
%11 = mul nsw i32 10, %10
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %8
%14 = alloca i8, i64 %12
store i64 %12, i64* %9
%15 = load i32, i32* %4
%16 = load i8*, i8** %5
%17 = call i32 @convex_hull_2d(i32 %15, i8* %16, i32* %7, i8* %14)
store i32 %17, i32* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %14, i64 %20
store i8 0, i8* %21
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%23 = load i8*, i8** %8
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@str = [48 x i8] c"Vertices and inner normals of the convex hull :\00"
define i32 @planar_hull(i32 %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = mul nsw i32 %0, 10
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = call i32 @convex_hull_2d(i32 %0, i8* %1, i32* %3, i8* %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %8, i64 %12
store i8 0, i8* %13
%14 = call i32 @puts(i8* %8)
ret i32 undef
}