#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 *concat_tab(int *, unsigned int, int *, unsigned int);
int /*<<< orphan*/ free_tab(int *);
int /*<<< orphan*/ printf(char *);
int *prompt_array(int *, unsigned int *);
int *do_concat(int array[], unsigned *size) {
  int *tab_to_concat = NULL;
  unsigned tab_to_concat_size = 0;
  printf("\n=== Saisie d'un tableau ===\n\n");
  tab_to_concat = prompt_array(tab_to_concat, &tab_to_concat_size);
  int *tab_concat = concat_tab(array, *size, tab_to_concat, tab_to_concat_size);
  *size += tab_to_concat_size;
  free_tab(array);
  free_tab(tab_to_concat);
  return tab_concat;
}


x86 assembly (clang, -O0):
<do_concat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <prompt_array@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <concat_tab@plt>
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
call   1060 <free_tab@plt>
mov    -0x18(%rbp),%rdi
call   1060 <free_tab@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_concat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
movl   $0x0,0x4(%rsp)
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
xor    %edi,%edi
call   1050 <prompt_array@plt>
mov    %rax,%rbx
mov    (%r15),%esi
mov    0x4(%rsp),%ecx
mov    %r14,%rdi
mov    %rax,%rdx
call   1040 <concat_tab@plt>
mov    %rax,%r12
mov    0x4(%rsp),%eax
add    %eax,(%r15)
mov    %r14,%rdi
call   1060 <free_tab@plt>
mov    %rbx,%rdi
call   1060 <free_tab@plt>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\0A=== Saisie d'un tableau ===\0A\0A\00"
define i32* @do_concat(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32* null, i32** %5
store i32 0, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %5
%10 = call i32* @prompt_array(i32* %9, i32* %6)
store i32* %10, i32** %5
%11 = load i32*, i32** %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = load i32*, i32** %5
%15 = load i32, i32* %6
%16 = call i32* @concat_tab(i32* %11, i32 %13, i32* %14, i32 %15)
store i32* %16, i32** %7
%17 = load i32, i32* %6
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = add i32 %19, %17
store i32 %20, i32* %18
%21 = load i32*, i32** %3
%22 = call i32 @free_tab(i32* %21)
%23 = load i32*, i32** %5
%24 = call i32 @free_tab(i32* %23)
%25 = load i32*, i32** %7
ret i32* %25
}

LLVM IR (-O2):
@str = [30 x i8] c"\0A=== Saisie d'un tableau ===\0A\00"
define i32* @do_concat(i32* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%6 = call i32* @prompt_array(i32* null, i32* %3)
%7 = load i32, i32* %1
%8 = load i32, i32* %3
%9 = call i32* @concat_tab(i32* %0, i32 %7, i32* %6, i32 %8)
%10 = load i32, i32* %3
%11 = load i32, i32* %1
%12 = add i32 %11, %10
store i32 %12, i32* %1
%13 = call i32 @free_tab(i32* %0)
%14 = call i32 @free_tab(i32* %6)
ret i32* %9
}