#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*/ adafinal();
int /*<<< orphan*/ adainit();
int /*<<< orphan*/ generate_points(int, int, char *);
int /*<<< orphan*/ hull_in_3d(int, char *);
int /*<<< orphan*/ hull_in_4d(int, char *);
int /*<<< orphan*/ planar_hull(int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
int main(void) {
  int dim, npts;
  adainit();
  printf("Give the ambient dimension : ");
  scanf("%d", &dim);
  printf("Give the number of points : ");
  scanf("%d", &npts);
  {
    char points[dim * 10 * npts];
    generate_points(dim, npts, points);
    printf("List of tuples : %s\n", points);
    printf("Number of characters : %d\n", strlen(points));
    if (dim == 2)
      planar_hull(strlen(points), points);
    else if (dim == 3)
      hull_in_3d(strlen(points), points);
    else
      hull_in_4d(strlen(points), points);
  }
  adafinal();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %al,-0x31(%rbp)
call   10b0 <adainit@plt>
mov    -0x31(%rbp),%al
lea    0xe4d(%rip),%rdi
call   1060 <printf@plt>
lea    0xe5f(%rip),%rdi
mov    %rdi,-0x30(%rbp)
lea    -0x8(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x31(%rbp),%al
lea    0xe4b(%rip),%rdi
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
imul   %eax,%ecx
add    %ecx,%ecx
mov    %ecx,%eax
lea    (%rax,%rax,4),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <generate_points@plt>
mov    -0x28(%rbp),%rsi
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    1274 <main+0xe4>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edi
call   1030 <planar_hull@plt>
jmp    12b0 <main+0x120>
cmpl   $0x3,-0x8(%rbp)
jne    1297 <main+0x107>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edi
call   1090 <hull_in_3d@plt>
jmp    12ab <main+0x11b>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edi
call   1040 <hull_in_4d@plt>
jmp    12b0 <main+0x120>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    $0x0,%al
call   1080 <adafinal@plt>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   10b0 <adainit@plt>
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe67(%rip),%rbx
lea    -0x14(%rbp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    -0x18(%rbp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
mov    %rsp,%r14
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    %rbx,%rdx
call   1070 <generate_points@plt>
lea    0xe2c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xe28(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %rbx,%rdi
cmp    $0x3,%eax
je     1255 <main+0xc5>
cmp    $0x2,%eax
jne    1266 <main+0xd6>
call   1050 <strlen@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <planar_hull@plt>
jmp    1275 <main+0xe5>
call   1050 <strlen@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1090 <hull_in_3d@plt>
jmp    1275 <main+0xe5>
call   1050 <strlen@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <hull_in_4d@plt>
mov    %r14,%rsp
xor    %eax,%eax
call   1080 <adafinal@plt>
xor    %eax,%eax
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Give the ambient dimension : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Give the number of points : \00"
@.str.3 = [21 x i8] c"List of tuples : %s\0A\00"
@.str.4 = [27 x i8] c"Number of characters : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 (...) @adainit()
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %2
%12 = mul nsw i32 %11, 10
%13 = load i32, i32* %3
%14 = mul nsw i32 %12, %13
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %4
%17 = alloca i8, i64 %15
store i64 %15, i64* %5
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @generate_points(i32 %18, i32 %19, i8* %17)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%22 = call i32 @strlen(i8* %17)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %29
26: ; preds = %0
%27 = call i32 @strlen(i8* %17)
%28 = call i32 @planar_hull(i32 %27, i8* %17)
br label %39
29: ; preds = %0
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 3
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = call i32 @strlen(i8* %17)
%34 = call i32 @hull_in_3d(i32 %33, i8* %17)
br label %38
35: ; preds = %29
%36 = call i32 @strlen(i8* %17)
%37 = call i32 @hull_in_4d(i32 %36, i8* %17)
br label %38
38: ; preds = %35, %32
br label %39
39: ; preds = %38, %26
%40 = load i8*, i8** %4
%41 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Give the ambient dimension : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Give the number of points : \00"
@.str.3 = [21 x i8] c"List of tuples : %s\0A\00"
@.str.4 = [27 x i8] c"Number of characters : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (...) @adainit()
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = mul nsw i32 %10, 10
%12 = load i32, i32* %2
%13 = mul nsw i32 %11, %12
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
%16 = alloca i8, i64 %14
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @generate_points(i32 %17, i32 %18, i8* %16)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%21 = call i32 @strlen(i8* %16)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
switch i32 %23, label %30 [
i32 2, label %24
i32 3, label %27
]
24: ; preds = %0
%25 = call i32 @strlen(i8* %16)
%26 = call i32 @planar_hull(i32 %25, i8* %16)
br label %33
27: ; preds = %0
%28 = call i32 @strlen(i8* %16)
%29 = call i32 @hull_in_3d(i32 %28, i8* %16)
br label %33
30: ; preds = %0
%31 = call i32 @strlen(i8* %16)
%32 = call i32 @hull_in_4d(i32 %31, i8* %16)
br label %33
33: ; preds = %27, %30, %24
%34 = call i32 (...) @adafinal()
ret i32 0
}