#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 */
scalar_t__ calloc(int, int);
int celcon_type_of_mixture(int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int show_mixture(int dim, int *r) {
  int fail, *mix, i;
  double *c;
  mix = (int *)calloc(dim, sizeof(int));
  fail = celcon_type_of_mixture(r, mix);
  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),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <celcon_type_of_mixture@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    117d <show_mixture+0x4d>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <show_mixture+0xba>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%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    11dc <show_mixture+0xac>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a6 <show_mixture+0x76>
lea    0xe4e(%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    %r12,%rdi
mov    %rax,%rsi
call   1070 <celcon_type_of_mixture@plt>
mov    %eax,%r14d
cmp    $0x1,%eax
jne    1189 <show_mixture+0x39>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
jmp    11e5 <show_mixture+0x95>
mov    (%r12),%esi
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,(%r12)
jle    11db <show_mixture+0x8b>
lea    0xe7e(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
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 i64 @calloc(i32 %9, i32 4)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %6
%12 = load i32*, i32** %4
%13 = load i32*, i32** %6
%14 = call i32 @celcon_type_of_mixture(i32* %12, i32* %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 i64 @calloc(i32 %0, i32 4)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i32 @celcon_type_of_mixture(i32* %1, i32* %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
br label %26
9: ; preds = %2
%10 = load i32, i32* %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %9, %15
%16 = phi i64 [ %20, %15 ], [ 0, %9 ]
%17 = getelementptr inbounds i32, i32* %4, i64 %16
%18 = load i32, i32* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = add nuw nsw i64 %16, 1
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %15, label %24
24: ; preds = %15, %9
%25 = tail call i32 @putchar(i32 10)
br label %26
26: ; preds = %24, %7
ret i32 %5
}