#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*/ my_putchar(char);
int /*<<< orphan*/ my_putnbr(int);
int display_tab(int *tab, int n) {
  int a;
  a = 0;
  if (n <= 0)
    return (-1);
  while (a < n) {
    if (tab[a] == 0)
      tab[a] = -1;
    my_putnbr(tab[a]);
    my_putchar(' ');
    a++;
  }
  my_putchar('\n');
  return (1);
}


x86 assembly (clang, -O0):
<display_tab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     114c <display_tab+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b7 <display_tab+0x97>
jmp    1151 <display_tab+0x31>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a6 <display_tab+0x86>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    117e <display_tab+0x5e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1040 <my_putnbr@plt>
mov    $0x20,%edi
call   1030 <my_putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1151 <display_tab+0x31>
mov    $0xa,%edi
call   1030 <my_putchar@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_tab>:
test   %esi,%esi
jle    1184 <display_tab+0x64>
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
jmp    1158 <display_tab+0x38>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1040 <my_putnbr@plt>
mov    $0x20,%edi
call   1030 <my_putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
je     116f <display_tab+0x4f>
mov    (%r15,%rbx,4),%edi
test   %edi,%edi
jne    1140 <display_tab+0x20>
movl   $0xffffffff,(%r15,%rbx,4)
ff
mov    $0xffffffff,%edi
jmp    1140 <display_tab+0x20>
mov    $0xa,%edi
call   1030 <my_putchar@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @display_tab(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
%7 = load i32, i32* %5
%8 = icmp sle i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 -1, i32* %3
br label %39
10: ; preds = %2
br label %11
11: ; preds = %27, %10
%12 = load i32, i32* %6
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %37
15: ; preds = %11
%16 = load i32*, i32** %4
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %15
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 -1, i32* %26
br label %27
27: ; preds = %22, %15
%28 = load i32*, i32** %4
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = call i32 @my_putnbr(i32 %32)
%34 = call i32 @my_putchar(i8 signext 32)
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %11
37: ; preds = %11
%38 = call i32 @my_putchar(i8 signext 10)
store i32 1, i32* %3
br label %39
39: ; preds = %37, %9
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
define i32 @display_tab(i32* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %20, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %12
%7 = phi i64 [ 0, %4 ], [ %16, %12 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %6
store i32 -1, i32* %8
br label %12
12: ; preds = %11, %6
%13 = phi i32 [ -1, %11 ], [ %9, %6 ]
%14 = tail call i32 @my_putnbr(i32 %13)
%15 = tail call i32 @my_putchar(i8 signext 32)
%16 = add nuw nsw i64 %7, 1
%17 = icmp eq i64 %16, %5
br i1 %17, label %18, label %6
18: ; preds = %12
%19 = tail call i32 @my_putchar(i8 signext 10)
br label %20
20: ; preds = %2, %18
%21 = phi i32 [ 1, %18 ], [ -1, %2 ]
ret i32 %21
}