#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__ strengthen_big_clause(int *, int);
int check_reduction(int *_literals) {
  int *literals = _literals;
  if (_literals[2] == 0)
    return 0;
  while (*literals != 0) {
    int lit = *(literals++);
    if (strengthen_big_clause(_literals, lit) == 0) {
      while (*literals != 0) {
        literals[-1] = *literals;
        literals++;
      }
      literals[-1] = *literals;
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_reduction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jne    113e <check_reduction+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    11cf <check_reduction+0xbf>
jmp    1143 <check_reduction+0x33>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
je     11c8 <check_reduction+0xb8>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <strengthen_big_clause@plt>
cmp    $0x0,%rax
jne    11c3 <check_reduction+0xb3>
jmp    117f <check_reduction+0x6f>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
je     11aa <check_reduction+0x9a>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,-0x4(%rax)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    117f <check_reduction+0x6f>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,-0x4(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11cf <check_reduction+0xbf>
jmp    1143 <check_reduction+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_reduction>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
cmpl   $0x0,0x8(%rdi)
je     1176 <check_reduction+0x66>
mov    %rdi,%rbp
mov    %rdi,%rbx
jmp    113c <check_reduction+0x2c>
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x0,-0x4(%rbx)
test   %rax,%rax
je     1170 <check_reduction+0x60>
mov    (%rbx),%esi
test   %esi,%esi
je     1176 <check_reduction+0x66>
add    $0x4,%rbx
mov    %rbp,%rdi
call   1030 <strengthen_big_clause@plt>
test   %rax,%rax
jne    1137 <check_reduction+0x27>
mov    (%rbx),%ecx
test   %ecx,%ecx
je     1130 <check_reduction+0x20>
nopl   0x0(%rax)
mov    %ecx,-0x4(%rbx)
mov    0x4(%rbx),%ecx
add    $0x4,%rbx
test   %ecx,%ecx
jne    1160 <check_reduction+0x50>
jmp    1130 <check_reduction+0x20>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_reduction(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
%6 = load i32*, i32** %3
store i32* %6, i32** %4
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 2
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %44
12: ; preds = %1
br label %13
13: ; preds = %42, %12
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %43
17: ; preds = %13
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i32 1
store i32* %19, i32** %4
%20 = load i32, i32* %18
store i32 %20, i32* %5
%21 = load i32*, i32** %3
%22 = load i32, i32* %5
%23 = call i64 @strengthen_big_clause(i32* %21, i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %42
25: ; preds = %17
br label %26
26: ; preds = %30, %25
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load i32*, i32** %4
%32 = load i32, i32* %31
%33 = load i32*, i32** %4
%34 = getelementptr inbounds i32, i32* %33, i64 -1
store i32 %32, i32* %34
%35 = load i32*, i32** %4
%36 = getelementptr inbounds i32, i32* %35, i32 1
store i32* %36, i32** %4
br label %26
37: ; preds = %26
%38 = load i32*, i32** %4
%39 = load i32, i32* %38
%40 = load i32*, i32** %4
%41 = getelementptr inbounds i32, i32* %40, i64 -1
store i32 %39, i32* %41
store i32 1, i32* %2
br label %44
42: ; preds = %17
br label %13
43: ; preds = %13
store i32 0, i32* %2
br label %44
44: ; preds = %43, %37, %11
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @check_reduction(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %28, label %5
5: ; preds = %1, %26
%6 = phi i32* [ %27, %26 ], [ %0, %1 ]
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %28, label %9
9: ; preds = %5
%10 = getelementptr inbounds i32, i32* %6, i64 1
%11 = tail call i64 @strengthen_big_clause(i32* %0, i32 %7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load i32, i32* %10
%15 = icmp eq i32 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %13, %16
%17 = phi i32 [ %21, %16 ], [ %14, %13 ]
%18 = phi i32* [ %20, %16 ], [ %10, %13 ]
%19 = getelementptr inbounds i32, i32* %18, i64 -1
store i32 %17, i32* %19
%20 = getelementptr inbounds i32, i32* %18, i64 1
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %16
23: ; preds = %16, %13
%24 = phi i32* [ %10, %13 ], [ %20, %16 ]
%25 = getelementptr inbounds i32, i32* %24, i64 -1
store i32 0, i32* %25
br label %26
26: ; preds = %9, %23
%27 = phi i32* [ %24, %23 ], [ %10, %9 ]
br i1 %12, label %28, label %5
28: ; preds = %5, %26, %1
%29 = phi i32 [ 0, %1 ], [ 0, %5 ], [ 1, %26 ]
ret i32 %29
}