#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 /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
float *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
void floatvmerge(float *a, float *b, size_t numrows, float **out) {
  size_t i;
  float *tmp;
  tmp = malloc(3 * numrows * sizeof(float));
  assert(tmp != NULL);
  for (i = 0; i < numrows; i++) {
    tmp[i * 3] = a[i * 2];
    tmp[i * 3 + 1] = a[i * 2 + 1];
    if (b[i * 2] != a[i * 2]) {
      printf("\n\n\tError in floatvmerge() (arraymanip.c)\n");
      printf("\t\tThe first columns are not equal on row %lu\n\n", i);
      exit(1);
    } else
      tmp[i * 3 + 2] = b[i * 2 + 1];
  }
  *out = tmp;
}


x86 assembly (clang, -O0):
<floatvmerge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
imul   $0x3,-0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1267 <floatvmerge+0x127>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
shl    $0x1,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x30(%rbp),%rax
imul   $0x3,-0x28(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
shl    $0x1,%rcx
movss  0x4(%rax,%rcx,4),%xmm0
mov    -0x30(%rbp),%rax
imul   $0x3,-0x28(%rbp),%rcx
movss  %xmm0,0x4(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
shl    $0x1,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
shl    $0x1,%rcx
ucomiss (%rax,%rcx,4),%xmm0
jne    1206 <floatvmerge+0xc6>
jp     1206 <floatvmerge+0xc6>
jmp    1230 <floatvmerge+0xf0>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
shl    $0x1,%rcx
movss  0x4(%rax,%rcx,4),%xmm0
mov    -0x30(%rbp),%rax
imul   $0x3,-0x28(%rbp),%rcx
movss  %xmm0,0x8(%rax,%rcx,4)
jmp    1256 <floatvmerge+0x116>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1186 <floatvmerge+0x46>
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatvmerge>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0x0(,%rdx,4),%eax
lea    (%rax,%rax,2),%edi
call   1060 <malloc@plt>
mov    %rax,%r13
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
test   %r15,%r15
je     11da <floatvmerge+0x8a>
lea    0x8(%r13),%rax
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%rbx,%rbp,8),%xmm0
movss  %xmm0,-0x8(%rax)
movss  0x4(%rbx,%rbp,8),%xmm1
movss  %xmm1,-0x4(%rax)
movss  (%r12,%rbp,8),%xmm1
ucomiss %xmm0,%xmm1
jne    11ec <floatvmerge+0x9c>
jp     11ec <floatvmerge+0x9c>
movss  0x4(%r12,%rbp,8),%xmm0
movss  %xmm0,(%rax)
add    $0x1,%rbp
add    $0xc,%rax
cmp    %rbp,%r15
jne    11a0 <floatvmerge+0x50>
mov    %r13,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe01(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"\0A\0A\09Error in floatvmerge() (arraymanip.c)\0A\00"
@.str.1 = [47 x i8] c"\09\09The first columns are not equal on row %lu\0A\0A\00"
define void @floatvmerge(float* %0, float* %1, i64 %2, float** %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca i64
%8 = alloca float**
%9 = alloca i64
%10 = alloca float*
store float* %0, float** %5
store float* %1, float** %6
store i64 %2, i64* %7
store float** %3, float*** %8
%11 = load i64, i64* %7
%12 = mul i64 3, %11
%13 = mul i64 %12, 4
%14 = trunc i64 %13 to i32
%15 = call float* @malloc(i32 %14)
store float* %15, float** %10
%16 = load float*, float** %10
%17 = icmp ne float* %16, null
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
store i64 0, i64* %9
br label %20
20: ; preds = %74, %4
%21 = load i64, i64* %9
%22 = load i64, i64* %7
%23 = icmp ult i64 %21, %22
br i1 %23, label %24, label %77
24: ; preds = %20
%25 = load float*, float** %5
%26 = load i64, i64* %9
%27 = mul i64 %26, 2
%28 = getelementptr inbounds float, float* %25, i64 %27
%29 = load float, float* %28
%30 = load float*, float** %10
%31 = load i64, i64* %9
%32 = mul i64 %31, 3
%33 = getelementptr inbounds float, float* %30, i64 %32
store float %29, float* %33
%34 = load float*, float** %5
%35 = load i64, i64* %9
%36 = mul i64 %35, 2
%37 = add i64 %36, 1
%38 = getelementptr inbounds float, float* %34, i64 %37
%39 = load float, float* %38
%40 = load float*, float** %10
%41 = load i64, i64* %9
%42 = mul i64 %41, 3
%43 = add i64 %42, 1
%44 = getelementptr inbounds float, float* %40, i64 %43
store float %39, float* %44
%45 = load float*, float** %6
%46 = load i64, i64* %9
%47 = mul i64 %46, 2
%48 = getelementptr inbounds float, float* %45, i64 %47
%49 = load float, float* %48
%50 = load float*, float** %5
%51 = load i64, i64* %9
%52 = mul i64 %51, 2
%53 = getelementptr inbounds float, float* %50, i64 %52
%54 = load float, float* %53
%55 = fcmp une float %49, %54
br i1 %55, label %56, label %61
56: ; preds = %24
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%58 = load i64, i64* %9
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i64 %58)
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %24
%62 = load float*, float** %6
%63 = load i64, i64* %9
%64 = mul i64 %63, 2
%65 = add i64 %64, 1
%66 = getelementptr inbounds float, float* %62, i64 %65
%67 = load float, float* %66
%68 = load float*, float** %10
%69 = load i64, i64* %9
%70 = mul i64 %69, 3
%71 = add i64 %70, 2
%72 = getelementptr inbounds float, float* %68, i64 %71
store float %67, float* %72
br label %73
73: ; preds = %61
br label %74
74: ; preds = %73
%75 = load i64, i64* %9
%76 = add i64 %75, 1
store i64 %76, i64* %9
br label %20
77: ; preds = %20
%78 = load float*, float** %10
%79 = load float**, float*** %8
store float* %78, float** %79
ret void
}

LLVM IR (-O2):
@.str.1 = [47 x i8] c"\09\09The first columns are not equal on row %lu\0A\0A\00"
@str = [41 x i8] c"\0A\0A\09Error in floatvmerge() (arraymanip.c)\00"
define void @floatvmerge(float* nocapture %0, float* nocapture %1, i64 %2, float** nocapture writeonly %3) {
%5 = trunc i64 %2 to i32
%6 = mul i32 %5, 12
%7 = tail call float* @malloc(i32 %6)
%8 = icmp ne float* %7, null
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = icmp eq i64 %2, 0
br i1 %11, label %38, label %12
12: ; preds = %4, %31
%13 = phi i64 [ %36, %31 ], [ 0, %4 ]
%14 = shl i64 %13, 1
%15 = getelementptr inbounds float, float* %0, i64 %14
%16 = load float, float* %15
%17 = mul i64 %13, 3
%18 = getelementptr inbounds float, float* %7, i64 %17
store float %16, float* %18
%19 = or i64 %14, 1
%20 = getelementptr inbounds float, float* %0, i64 %19
%21 = load float, float* %20
%22 = add i64 %17, 1
%23 = getelementptr inbounds float, float* %7, i64 %22
store float %21, float* %23
%24 = getelementptr inbounds float, float* %1, i64 %14
%25 = load float, float* %24
%26 = fcmp une float %25, %16
br i1 %26, label %27, label %31
27: ; preds = %12
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i64 %13)
%30 = tail call i32 @exit(i32 1)
unreachable
31: ; preds = %12
%32 = getelementptr inbounds float, float* %1, i64 %19
%33 = load float, float* %32
%34 = add i64 %17, 2
%35 = getelementptr inbounds float, float* %7, i64 %34
store float %33, float* %35
%36 = add nuw i64 %13, 1
%37 = icmp eq i64 %36, %2
br i1 %37, label %38, label %12
38: ; preds = %31, %4
store float* %7, float** %3
ret void
}