#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 /*<<< orphan*/ check_intcelcon(int, int, int *);
int intcelcon_make_subdivision();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ write_integer_lifted_supports(int, int, int *);
int /*<<< orphan*/ write_integer_mixed_cells(int);
void test_intcelcon(void) {
  int n, r, i, fail;
  printf("\nTesting the integer cells container ...\n");
  printf("-> give the size of the lifted points : ");
  scanf("%d", &n);
  printf("-> give the number of distinct supports : ");
  scanf("%d", &r);
  {
    int smx;
    int *mix;
    mix = (int *)calloc(r, sizeof(int));
    if (r == n - 1)
      for (i = 0; i < r; i++)
        mix[i] = 1;
    else {
      for (i = 0; i < r; i++) {
        printf("-> give frequency of support %d : ", i + 1);
        scanf("%d", &mix[i]);
      }
    }
    printf("The mixture : ");
    for (i = 0, smx = 0; i < r; smx += mix[i++])
      printf(" %d", mix[i]);
    printf(" = %d", smx);
    if (smx == n - 1) {
      printf("  okay\n");
      check_intcelcon(n, r, mix);
      write_integer_lifted_supports(n, r, mix);
      printf("computing the mixed cells ...\n");
      fail = intcelcon_make_subdivision();
      write_integer_mixed_cells(n);
    } else
      printf(" != %d\n", n - 1);
  }
}


x86 assembly (clang, -O0):
<test_intcelcon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf18(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1090 <scanf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xefa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1219 <test_intcelcon+0xa9>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1214 <test_intcelcon+0xa4>
mov    -0x20(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11eb <test_intcelcon+0x7b>
jmp    126e <test_intcelcon+0xfe>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1269 <test_intcelcon+0xf9>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5d(%rip),%rdi
call   1090 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1220 <test_intcelcon+0xb0>
jmp    126e <test_intcelcon+0xfe>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12cf <test_intcelcon+0x15f>
mov    -0x20(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    128a <test_intcelcon+0x11a>
mov    -0x14(%rbp),%esi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1342 <test_intcelcon+0x1d2>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <check_intcelcon@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <write_integer_lifted_supports@plt>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <intcelcon_make_subdivision@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1080 <write_integer_mixed_cells@plt>
jmp    1356 <test_intcelcon+0x1e6>
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_intcelcon>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xe61(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xedc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <scanf@plt>
mov    0x8(%rsp),%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%r15
mov    0x8(%rsp),%eax
mov    0xc(%rsp),%ecx
add    $0xffffffff,%ecx
cmp    %ecx,%eax
jne    1218 <test_intcelcon+0x98>
test   %eax,%eax
jle    1259 <test_intcelcon+0xd9>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movl   $0x1,(%r15,%rax,4)
add    $0x1,%rax
movslq 0x8(%rsp),%rcx
cmp    %rcx,%rax
jl     1200 <test_intcelcon+0x80>
jmp    1259 <test_intcelcon+0xd9>
test   %eax,%eax
jle    1259 <test_intcelcon+0xd9>
lea    0xe31(%rip),%r14
lea    0xe5f(%rip),%r12
mov    %r15,%rbx
xor    %ebp,%ebp
nop
add    $0x1,%rbp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <scanf@plt>
movslq 0x8(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     1230 <test_intcelcon+0xb0>
lea    0xe17(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,0x8(%rsp)
jle    12a0 <test_intcelcon+0x120>
lea    0xe11(%rip),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    (%r15,%rbx,4),%ebp
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1280 <test_intcelcon+0x100>
lea    0xddf(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%esi
add    $0xffffffff,%esi
cmp    %esi,%ebp
jne    1305 <test_intcelcon+0x185>
lea    0xdfb(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r15,%rdx
call   1050 <check_intcelcon@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r15,%rdx
call   1040 <write_integer_lifted_supports@plt>
lea    0xdd6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <intcelcon_make_subdivision@plt>
mov    0xc(%rsp),%edi
call   1090 <write_integer_mixed_cells@plt>
jmp    1313 <test_intcelcon+0x193>
lea    0xd80(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"\0ATesting the integer cells container ...\0A\00"
@.str.1 = [41 x i8] c"-> give the size of the lifted points : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [43 x i8] c"-> give the number of distinct supports : \00"
@.str.4 = [35 x i8] c"-> give frequency of support %d : \00"
@.str.5 = [15 x i8] c"The mixture : \00"
@.str.6 = [4 x i8] c" %d\00"
@.str.7 = [6 x i8] c" = %d\00"
@.str.8 = [8 x i8] c" okay\0A\00"
@.str.9 = [31 x i8] c"computing the mixed cells ...\0A\00"
@.str.10 = [8 x i8] c" != %d\0A\00"
define void @test_intcelcon() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = call i64 @calloc(i32 %12, i32 4)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %6
%15 = load i32, i32* %2
%16 = load i32, i32* %1
%17 = sub nsw i32 %16, 1
%18 = icmp eq i32 %15, %17
br i1 %18, label %19, label %33
19: ; preds = %0
store i32 0, i32* %3
br label %20
20: ; preds = %29, %19
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i32*, i32** %6
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
store i32 1, i32* %28
br label %29
29: ; preds = %24
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %20
32: ; preds = %20
br label %51
33: ; preds = %0
store i32 0, i32* %3
br label %34
34: ; preds = %47, %33
%35 = load i32, i32* %3
%36 = load i32, i32* %2
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %50
38: ; preds = %34
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %40)
%42 = load i32*, i32** %6
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %45)
br label %47
47: ; preds = %38
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %34
50: ; preds = %34
br label %51
51: ; preds = %50, %32
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
store i32 0, i32* %5
br label %53
53: ; preds = %64, %51
%54 = load i32, i32* %3
%55 = load i32, i32* %2
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %73
57: ; preds = %53
%58 = load i32*, i32** %6
%59 = load i32, i32* %3
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %57
%65 = load i32*, i32** %6
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
%68 = sext i32 %66 to i64
%69 = getelementptr inbounds i32, i32* %65, i64 %68
%70 = load i32, i32* %69
%71 = load i32, i32* %5
%72 = add nsw i32 %71, %70
store i32 %72, i32* %5
br label %53
73: ; preds = %53
%74 = load i32, i32* %5
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %74)
%76 = load i32, i32* %5
%77 = load i32, i32* %1
%78 = sub nsw i32 %77, 1
%79 = icmp eq i32 %76, %78
br i1 %79, label %80, label %94
80: ; preds = %73
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%82 = load i32, i32* %1
%83 = load i32, i32* %2
%84 = load i32*, i32** %6
%85 = call i32 @check_intcelcon(i32 %82, i32 %83, i32* %84)
%86 = load i32, i32* %1
%87 = load i32, i32* %2
%88 = load i32*, i32** %6
%89 = call i32 @write_integer_lifted_supports(i32 %86, i32 %87, i32* %88)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
%91 = call i32 (...) @intcelcon_make_subdivision()
store i32 %91, i32* %4
%92 = load i32, i32* %1
%93 = call i32 @write_integer_mixed_cells(i32 %92)
br label %98
94: ; preds = %73
%95 = load i32, i32* %1
%96 = sub nsw i32 %95, 1
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32 %96)
br label %98
98: ; preds = %94, %80
ret void
}

LLVM IR (-O2):
@.str.1 = [41 x i8] c"-> give the size of the lifted points : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [43 x i8] c"-> give the number of distinct supports : \00"
@.str.4 = [35 x i8] c"-> give frequency of support %d : \00"
@.str.5 = [15 x i8] c"The mixture : \00"
@.str.6 = [4 x i8] c" %d\00"
@.str.7 = [6 x i8] c" = %d\00"
@.str.10 = [8 x i8] c" != %d\0A\00"
@str = [41 x i8] c"\0ATesting the integer cells container ...\00"
@str.11 = [7 x i8] c" okay\00"
@str.12 = [30 x i8] c"computing the mixed cells ...\00"
define void @test_intcelcon() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = call i64 @calloc(i32 %10, i32 4)
%12 = inttoptr i64 %11 to i32*
%13 = load i32, i32* %2
%14 = load i32, i32* %1
%15 = add nsw i32 %14, -1
%16 = icmp eq i32 %13, %15
%17 = icmp sgt i32 %13, 0
br i1 %16, label %19, label %18
18: ; preds = %0
br i1 %17, label %27, label %37
19: ; preds = %0
br i1 %17, label %20, label %37
20: ; preds = %19, %20
%21 = phi i64 [ %23, %20 ], [ 0, %19 ]
%22 = getelementptr inbounds i32, i32* %12, i64 %21
store i32 1, i32* %22
%23 = add nuw nsw i64 %21, 1
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = icmp slt i64 %23, %25
br i1 %26, label %20, label %37
27: ; preds = %18, %27
%28 = phi i64 [ %29, %27 ], [ 0, %18 ]
%29 = add nuw nsw i64 %28, 1
%30 = trunc i64 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds i32, i32* %12, i64 %28
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %32)
%34 = load i32, i32* %2
%35 = sext i32 %34 to i64
%36 = icmp slt i64 %29, %35
br i1 %36, label %27, label %37
37: ; preds = %27, %20, %18, %19
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%39 = load i32, i32* %2
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %53
41: ; preds = %37, %41
%42 = phi i64 [ %47, %41 ], [ 0, %37 ]
%43 = phi i32 [ %49, %41 ], [ 0, %37 ]
%44 = getelementptr inbounds i32, i32* %12, i64 %42
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %45)
%47 = add nuw nsw i64 %42, 1
%48 = load i32, i32* %44
%49 = add nsw i32 %48, %43
%50 = load i32, i32* %2
%51 = sext i32 %50 to i64
%52 = icmp slt i64 %47, %51
br i1 %52, label %41, label %53
53: ; preds = %41, %37
%54 = phi i32 [ 0, %37 ], [ %49, %41 ]
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %1
%57 = add nsw i32 %56, -1
%58 = icmp eq i32 %54, %57
br i1 %58, label %59, label %71
59: ; preds = %53
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.11, i64 0, i64 0))
%61 = load i32, i32* %1
%62 = load i32, i32* %2
%63 = call i32 @check_intcelcon(i32 %61, i32 %62, i32* %12)
%64 = load i32, i32* %1
%65 = load i32, i32* %2
%66 = call i32 @write_integer_lifted_supports(i32 %64, i32 %65, i32* %12)
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.12, i64 0, i64 0))
%68 = call i32 (...) @intcelcon_make_subdivision()
%69 = load i32, i32* %1
%70 = call i32 @write_integer_mixed_cells(i32 %69)
br label %73
71: ; preds = %53
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i32 %57)
br label %73
73: ; preds = %71, %59
ret void
}