#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 */
typedef int /*<<< orphan*/ a2;
typedef int /*<<< orphan*/ a1;

/* Variables and functions */
int *add_string(int *, int *, int, int, int *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a1[] = {8, 2, 3};
  int a2[] = {9, 7};
  int res_size = 0;
  int *res;
  int size1 = sizeof(a1) / sizeof(a1[0]);
  int size2 = sizeof(a2) / sizeof(a2[0]);
  res = add_string(a1, a2, size1, size2, &res_size);
  for (int i = 0; i < res_size; i++) {
    printf("%d ", res[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x3,-0x2c(%rbp)
movl   $0x2,-0x30(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
lea    -0x1c(%rbp),%r8
call   1040 <add_string@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b6 <main+0x96>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1185 <main+0x65>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    0xed9(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xec6(%rip),%rax
mov    %rax,0x10(%rsp)
movabs $0x700000009,%rax
mov    %rax,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%r8
mov    $0x3,%edx
mov    $0x2,%ecx
call   1040 <add_string@plt>
cmpl   $0x0,0x4(%rsp)
jle    11aa <main+0x8a>
mov    %rax,%r15
xor    %ebx,%ebx
lea    0xe85(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     1190 <main+0x70>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.a1 = [3 x i32] [i32 8, i32 2, i32 3]
@__const.main.a2 = [2 x i32] [i32 9, i32 7]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [3 x i32]* %2 to i8*
%10 = bitcast [2 x i32]* %3 to i8*
store i32 0, i32* %4
store i32 3, i32* %6
store i32 2, i32* %7
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = call i32* @add_string(i32* %11, i32* %12, i32 %13, i32 %14, i32* %4)
store i32* %15, i32** %5
store i32 0, i32* %8
br label %16
16: ; preds = %27, %0
%17 = load i32, i32* %8
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i32*, i32** %5
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %20
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %16
30: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@__const.main.a1 = [3 x i32] [i32 8, i32 2, i32 3]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca i64
%3 = alloca i32
%4 = bitcast [3 x i32]* %1 to i8*
%5 = bitcast i64* %2 to i8*
store i64 30064771081, i64* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%8 = bitcast i64* %2 to i32*
%9 = call i32* @add_string(i32* %7, i32* %8, i32 3, i32 2, i32* %3)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %13, %0
ret i32 0
13: ; preds = %0, %13
%14 = phi i64 [ %18, %13 ], [ 0, %0 ]
%15 = getelementptr inbounds i32, i32* %9, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i64 %14, 1
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %13, label %12
}