#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 calculat_group_numbers(int /*<<< orphan*/, int);
int /*<<< orphan*/ memory_move_write(int /*<<< orphan*/, int, int *, int, int *,
                                     int);
int test_memory_move_write_5(void) {
  int buf_test1[4];
  int buf_test2[4];
  int group_read_from;
  int group_read_to;
  int group_write_from;
  int group_write_to;
  buf_test1[0] = 0x87654321;
  buf_test1[1] = 0x0fedcba9;
  group_write_from = (((8) + 31) / 32);
  group_write_to = calculat_group_numbers(0, 8);
  memory_move_write(0, 8, buf_test1, group_write_from, buf_test2,
                    group_write_to);
  if (buf_test2[0] == 0x21) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<test_memory_move_write_5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x87654321,-0x20(%rbp)
movl   $0xfedcba9,-0x1c(%rbp)
movl   $0x1,-0x3c(%rbp)
xor    %edi,%edi
mov    $0x8,%esi
call   1040 <calculat_group_numbers@plt>
mov    %eax,-0x40(%rbp)
lea    -0x20(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
lea    -0x30(%rbp),%r8
mov    -0x40(%rbp),%r9d
xor    %edi,%edi
mov    $0x8,%esi
call   1030 <memory_move_write@plt>
cmpl   $0x21,-0x30(%rbp)
jne    117d <test_memory_move_write_5+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    1184 <test_memory_move_write_5+0x64>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_memory_move_write_5>:
sub    $0x28,%rsp
movabs $0xfedcba987654321,%rax
cb ed 0f
mov    %rax,0x10(%rsp)
xor    %edi,%edi
mov    $0x8,%esi
call   1040 <calculat_group_numbers@plt>
lea    0x10(%rsp),%rdx
mov    %rsp,%r8
xor    %edi,%edi
mov    $0x8,%esi
mov    $0x1,%ecx
mov    %eax,%r9d
call   1030 <memory_move_write@plt>
xor    %eax,%eax
cmpl   $0x21,(%rsp)
setne  %al
neg    %eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @test_memory_move_write_5() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca [4 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
store i32 -2023406815, i32* %8
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
store i32 267242409, i32* %9
store i32 1, i32* %6
%10 = call i32 @calculat_group_numbers(i32 0, i32 8)
store i32 %10, i32* %7
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %6
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%14 = load i32, i32* %7
%15 = call i32 @memory_move_write(i32 0, i32 8, i32* %11, i32 %12, i32* %13, i32 %14)
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 33
br i1 %18, label %19, label %20
19: ; preds = %0
store i32 0, i32* %1
br label %21
20: ; preds = %0
store i32 -1, i32* %1
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
define i32 @test_memory_move_write_5() {
%1 = alloca [4 x i32]
%2 = alloca [4 x i32]
%3 = bitcast [4 x i32]* %1 to i8*
%4 = bitcast [4 x i32]* %2 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
store i32 -2023406815, i32* %5
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
store i32 267242409, i32* %6
%7 = tail call i32 @calculat_group_numbers(i32 0, i32 8)
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%9 = call i32 @memory_move_write(i32 0, i32 8, i32* %5, i32 1, i32* %8, i32 %7)
%10 = load i32, i32* %8
%11 = icmp ne i32 %10, 33
%12 = sext i1 %11 to i32
ret i32 %12
}