#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 */
typedef int /*<<< orphan*/ mp_limb_t;

/* Variables and functions */
int GMP_NUMB_BITS;
int /*<<< orphan*/ printf(char *, ...);
void mp_print(const mp_limb_t *x, const int N) {
  int i;
  for (i = 0; i < N; ++i) {
    if (i > 0)
      printf(" + ");
    printf("%lu", x[i]);
    if (i > 0)
      printf("*2^%d", i * GMP_NUMB_BITS);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<mp_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119b <mp_print+0x8b>
cmpl   $0x0,-0x10(%rbp)
jle    114a <mp_print+0x3a>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
jle    1188 <mp_print+0x78>
mov    -0x10(%rbp),%esi
mov    0x2e69(%rip),%rax
imul   (%rax),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118d <mp_print+0x7d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <mp_print+0x16>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11a6 <mp_print+0x86>
mov    %esi,%ebp
mov    %rdi,%r13
mov    (%rdi),%esi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%ebp
je     11a6 <mp_print+0x86>
mov    %ebp,%ebp
mov    $0x1,%ebx
lea    0xead(%rip),%r15
mov    0x2e82(%rip),%r14
lea    0xea3(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%r13,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r14),%esi
imul   %ebx,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <mp_print+0x50>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c" + \00"
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [6 x i8] c"*2^%d\00"
@GMP_NUMB_BITS = global i32 0
define void @mp_print(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = load i32, i32* %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %1, 1
br i1 %8, label %21, label %9
9: ; preds = %4, %9
%10 = phi i64 [ %19, %9 ], [ 1, %4 ]
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds i32, i32* %0, i64 %10
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @GMP_NUMB_BITS
%16 = trunc i64 %10 to i32
%17 = mul nsw i32 %15, %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = add nuw nsw i64 %10, 1
%20 = icmp eq i64 %19, %5
br i1 %20, label %21, label %9
21: ; preds = %9, %4, %2
%22 = tail call i32 @putchar(i32 10)
ret void
}