#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 bigprint(int *s) {
  int i = 1000 - 1;
  while (i > 0 && s[i] == 0)
    i--;
  while (i >= 0)
    printf("%d", s[i--]);
  printf("\n");
}


x86 assembly (clang, -O0):
<bigprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x3e7,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jle    1144 <bigprint+0x34>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1154 <bigprint+0x44>
jmp    1162 <bigprint+0x52>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <bigprint+0x13>
jmp    1167 <bigprint+0x57>
cmpl   $0x0,-0xc(%rbp)
jl     1199 <bigprint+0x89>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1167 <bigprint+0x57>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bigprint>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0x3e8,%ecx
nopl   (%rax)
lea    -0x1(%rcx),%eax
cmpl   $0x0,(%r15,%rax,4)
jne    115a <bigprint+0x3a>
lea    -0x2(%rcx),%eax
cmpl   $0x0,(%r15,%rax,4)
jne    115a <bigprint+0x3a>
lea    -0x3(%rcx),%eax
cmpl   $0x0,(%r15,%rax,4)
jne    115a <bigprint+0x3a>
add    $0xfffffffd,%ecx
cmp    $0x1,%ecx
ja     1130 <bigprint+0x10>
xor    %eax,%eax
jmp    115e <bigprint+0x3e>
test   %eax,%eax
js     1184 <bigprint+0x64>
mov    %eax,%ebx
lea    0xe99(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
jb     1170 <bigprint+0x50>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @bigprint(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 999, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32*, i32** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br label %14
14: ; preds = %7, %4
%15 = phi i1 [ false, %4 ], [ %13, %7 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i32, i32* %3
%18 = add nsw i32 %17, -1
store i32 %18, i32* %3
br label %4
19: ; preds = %14
br label %20
20: ; preds = %23, %19
%21 = load i32, i32* %3
%22 = icmp sge i32 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = load i32*, i32** %2
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
store i32 %26, i32* %3
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i32, i32* %24, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %20
31: ; preds = %20
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @bigprint(i32* nocapture %0) {
br label %2
2: ; preds = %20, %1
%3 = phi i32 [ 999, %1 ], [ %21, %20 ]
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %2
%9 = add nsw i32 %3, -1
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %8
%15 = add nsw i32 %3, -2
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = add nsw i32 %3, -3
%22 = icmp ugt i32 %15, 1
br i1 %22, label %2, label %26
23: ; preds = %14, %8, %2
%24 = phi i32 [ %3, %2 ], [ %9, %8 ], [ %15, %14 ]
%25 = icmp sgt i32 %24, -1
br i1 %25, label %26, label %36
26: ; preds = %20, %23
%27 = phi i32 [ %24, %23 ], [ 0, %20 ]
%28 = zext i32 %27 to i64
br label %29
29: ; preds = %26, %29
%30 = phi i64 [ %28, %26 ], [ %31, %29 ]
%31 = add nsw i64 %30, -1
%32 = getelementptr inbounds i32, i32* %0, i64 %30
%33 = load i32, i32* %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = icmp eq i64 %30, 0
br i1 %35, label %36, label %29
36: ; preds = %29, %23
%37 = tail call i32 @putchar(i32 10)
ret void
}