#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*/ printf(char *, ...);
void printClause(int *clause) {
  printf("[%i] ", clause[-1]);
  while (*clause)
    printf("%i ", *clause++);
  printf("0\n");
}


x86 assembly (clang, -O0):
<printClause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x4(%rax),%esi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     1162 <printClause+0x52>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1131 <printClause+0x21>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printClause>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    -0x4(%rdi),%esi
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%esi
test   %esi,%esi
je     1164 <printClause+0x44>
add    $0x4,%rbx
lea    0xebd(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%esi
add    $0x4,%rbx
test   %esi,%esi
jne    1150 <printClause+0x30>
lea    0xe9f(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"[%i] \00"
@.str.1 = [4 x i8] c"%i \00"
@.str.2 = [3 x i8] c"0\0A\00"
define void @printClause(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 -1
%5 = load i32, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %7
7: ; preds = %11, %1
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i32 1
store i32* %13, i32** %2
%14 = load i32, i32* %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %7
16: ; preds = %7
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"[%i] \00"
@.str.1 = [4 x i8] c"%i \00"
@str = [2 x i8] c"0\00"
define void @printClause(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 -1
%3 = load i32, i32* %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %7
%8 = phi i32 [ %12, %7 ], [ %5, %1 ]
%9 = phi i32* [ %10, %7 ], [ %0, %1 ]
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%12 = load i32, i32* %10
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %1
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}