#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 intcelcon_get_inner_normal(int, int, int *);
int intcelcon_mixed_volume(int, int *);
int intcelcon_number_of_cells(int *);
int /*<<< orphan*/ printf(char *, int);
void write_integer_mixed_cells(int n) {
  int nbcells, fail, i, j, mv, mixvol;
  int normal[n];
  fail = intcelcon_number_of_cells(&nbcells);
  printf("The number of mixed cells : %d\n", nbcells);
  mixvol = 0;
  for (i = 1; i <= nbcells; i++) {
    printf("Inner normal for cell %d :", i);
    fail = intcelcon_get_inner_normal(n, i, normal);
    for (j = 0; j < n; j++)
      printf(" %d", normal[j]);
    fail = intcelcon_mixed_volume(i, &mv);
    printf(", volume : %d \n", mv);
    mixvol = mixvol + mv;
  }
  printf("The mixed volume : %d.\n", mixvol);
}


x86 assembly (clang, -O0):
<write_integer_mixed_cells>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <intcelcon_number_of_cells@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1235 <write_integer_mixed_cells+0xf5>
mov    -0x10(%rbp),%esi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rdx
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <intcelcon_get_inner_normal@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1200 <write_integer_mixed_cells+0xc0>
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cf <write_integer_mixed_cells+0x8f>
mov    -0x10(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1060 <intcelcon_mixed_volume@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119b <write_integer_mixed_cells+0x5b>
mov    -0x1c(%rbp),%esi
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_integer_mixed_cells>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsp,-0x40(%rbp)
mov    %edi,-0x34(%rbp)
mov    %edi,%r14d
mov    %rsp,%rbx
lea    0xf(,%r14,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x2c(%rbp),%rdi
call   1050 <intcelcon_number_of_cells@plt>
mov    -0x2c(%rbp),%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1227 <write_integer_mixed_cells+0xe7>
xor    %esi,%esi
mov    $0x1,%r13d
lea    0xe9a(%rip),%r12
jmp    11df <write_integer_mixed_cells+0x9f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13d,%edi
lea    -0x30(%rbp),%rsi
call   1060 <intcelcon_mixed_volume@plt>
mov    -0x30(%rbp),%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%rsi
add    -0x30(%rbp),%esi
lea    0x1(%r13),%eax
cmp    -0x2c(%rbp),%r13d
mov    %eax,%r13d
jge    1229 <write_integer_mixed_cells+0xe9>
mov    %rsi,-0x48(%rbp)
lea    0xe36(%rip),%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
mov    -0x34(%rbp),%r15d
mov    %r15d,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
call   1040 <intcelcon_get_inner_normal@plt>
test   %r15d,%r15d
jle    11b0 <write_integer_mixed_cells+0x70>
xor    %r15d,%r15d
nopl   0x0(%rax)
mov    (%rbx,%r15,4),%esi
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r14
jne    1210 <write_integer_mixed_cells+0xd0>
jmp    11b0 <write_integer_mixed_cells+0x70>
xor    %esi,%esi
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"The number of mixed cells : %d\0A\00"
@.str.1 = [27 x i8] c"Inner normal for cell %d :\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [16 x i8] c", volume : %d \0A\00"
@.str.4 = [24 x i8] c"The mixed volume : %d.\0A\00"
define void @write_integer_mixed_cells(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
store i32 %0, i32* %2
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %9
%14 = alloca i32, i64 %12
store i64 %12, i64* %10
%15 = call i32 @intcelcon_number_of_cells(i32* %3)
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %16)
store i32 0, i32* %8
store i32 1, i32* %5
br label %18
18: ; preds = %49, %1
%19 = load i32, i32* %5
%20 = load i32, i32* %3
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %52
22: ; preds = %18
%23 = load i32, i32* %5
%24 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %2
%26 = load i32, i32* %5
%27 = call i32 @intcelcon_get_inner_normal(i32 %25, i32 %26, i32* %14)
store i32 %27, i32* %4
store i32 0, i32* %6
br label %28
28: ; preds = %38, %22
%29 = load i32, i32* %6
%30 = load i32, i32* %2
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %14, i64 %34
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %28
41: ; preds = %28
%42 = load i32, i32* %5
%43 = call i32 @intcelcon_mixed_volume(i32 %42, i32* %7)
store i32 %43, i32* %4
%44 = load i32, i32* %7
%45 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %8
%47 = load i32, i32* %7
%48 = add nsw i32 %46, %47
store i32 %48, i32* %8
br label %49
49: ; preds = %41
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %18
52: ; preds = %18
%53 = load i32, i32* %8
%54 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %53)
%55 = load i8*, i8** %9
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"The number of mixed cells : %d\0A\00"
@.str.1 = [27 x i8] c"Inner normal for cell %d :\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [16 x i8] c", volume : %d \0A\00"
@.str.4 = [24 x i8] c"The mixed volume : %d.\0A\00"
define void @write_integer_mixed_cells(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = zext i32 %0 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = call i32 @intcelcon_number_of_cells(i32* %2)
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 1
br i1 %13, label %37, label %14
14: ; preds = %1
%15 = icmp sgt i32 %0, 0
br label %16
16: ; preds = %14, %28
%17 = phi i32 [ 1, %14 ], [ %34, %28 ]
%18 = phi i32 [ 0, %14 ], [ %33, %28 ]
%19 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%20 = call i32 @intcelcon_get_inner_normal(i32 %0, i32 %17, i32* %8)
br i1 %15, label %21, label %28
21: ; preds = %16, %21
%22 = phi i64 [ %26, %21 ], [ 0, %16 ]
%23 = getelementptr inbounds i32, i32* %8, i64 %22
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = add nuw nsw i64 %22, 1
%27 = icmp eq i64 %26, %6
br i1 %27, label %28, label %21
28: ; preds = %21, %16
%29 = call i32 @intcelcon_mixed_volume(i32 %17, i32* %3)
%30 = load i32, i32* %3
%31 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %3
%33 = add nsw i32 %32, %18
%34 = add nuw nsw i32 %17, 1
%35 = load i32, i32* %2
%36 = icmp slt i32 %17, %35
br i1 %36, label %16, label %37
37: ; preds = %28, %1
%38 = phi i32 [ 0, %1 ], [ %33, %28 ]
%39 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %38)
ret void
}