#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 _ada_use_celcon(int, int *, int *, double *);
int *calloc(int, int);
int /*<<< orphan*/ printf(char *, ...);
int show_mixture(int dim, int *r) {
  int fail, *mix, i;
  double *c;
  mix = calloc(dim, sizeof(int));
  fail = _ada_use_celcon(4, r, mix, c);
  if (fail == 1)
    printf("An error occurred, type of mixture not available.\n");
  else {
    printf("number of different supports : %d\n", *r);
    printf("type of mixture :");
    for (i = 0; i < *r; i++)
      printf(" %d", mix[i]);
    printf("\n");
  }
  return fail;
}


x86 assembly (clang, -O0):
<show_mixture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    $0x4,%edi
call   1050 <_ada_use_celcon@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1186 <show_mixture+0x56>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f3 <show_mixture+0xc3>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    11e5 <show_mixture+0xb5>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11af <show_mixture+0x7f>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_mixture>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,%rbp
mov    $0x4,%edi
mov    %r12,%rsi
mov    %rax,%rdx
call   1070 <_ada_use_celcon@plt>
mov    %eax,%r14d
cmp    $0x1,%eax
jne    118e <show_mixture+0x3e>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
jmp    11e5 <show_mixture+0x95>
mov    (%r12),%esi
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,(%r12)
jle    11db <show_mixture+0x8b>
lea    0xe79(%rip),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
mov    0x0(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq (%r12),%rax
cmp    %rax,%rbx
jl     11c0 <show_mixture+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"An error occurred, type of mixture not available.\0A\00"
@.str.1 = [35 x i8] c"number of different supports : %d\0A\00"
@.str.2 = [18 x i8] c"type of mixture :\00"
@.str.3 = [4 x i8] c" %d\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @show_mixture(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca double*
store i32 %0, i32* %3
store i32* %1, i32** %4
%9 = load i32, i32* %3
%10 = call i32* @calloc(i32 %9, i32 4)
store i32* %10, i32** %6
%11 = load i32*, i32** %4
%12 = load i32*, i32** %6
%13 = load double*, double** %8
%14 = call i32 @_ada_use_celcon(i32 4, i32* %11, i32* %12, double* %13)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %41
19: ; preds = %2
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %24
24: ; preds = %36, %19
%25 = load i32, i32* %7
%26 = load i32*, i32** %4
%27 = load i32, i32* %26
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %39
29: ; preds = %24
%30 = load i32*, i32** %6
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %29
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %24
39: ; preds = %24
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %41
41: ; preds = %39, %17
%42 = load i32, i32* %5
ret i32 %42
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c"number of different supports : %d\0A\00"
@.str.2 = [18 x i8] c"type of mixture :\00"
@.str.3 = [4 x i8] c" %d\00"
@str = [50 x i8] c"An error occurred, type of mixture not available.\00"
define i32 @show_mixture(i32 %0, i32* %1) {
%3 = tail call i32* @calloc(i32 %0, i32 4)
%4 = tail call i32 @_ada_use_celcon(i32 4, i32* %1, i32* %3, double* undef)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
br label %25
8: ; preds = %2
%9 = load i32, i32* %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %8, %14
%15 = phi i64 [ %19, %14 ], [ 0, %8 ]
%16 = getelementptr inbounds i32, i32* %3, i64 %15
%17 = load i32, i32* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = add nuw nsw i64 %15, 1
%20 = load i32, i32* %1
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %19, %21
br i1 %22, label %14, label %23
23: ; preds = %14, %8
%24 = tail call i32 @putchar(i32 10)
br label %25
25: ; preds = %23, %6
ret i32 %4
}