#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned int *, unsigned char *, int);
int /*<<< orphan*/ print_encoded_mime_type(int /*<<< orphan*/ *, char *, int,
                                           unsigned int *, int, char *);
int print_encoded_accept(FILE *fp, char *hdr, int hdrlen,
                         unsigned char *payload, int paylen, char *prefix) {
  int i;
  unsigned int type;
  for (i = 0; i < payload[0]; i++) {
    memcpy(&type, &payload[1 + i * sizeof(unsigned int)], sizeof(unsigned int));
    print_encoded_mime_type(fp, hdr, hdrlen, &type, 4, prefix);
  }
  return 1;
}


x86 assembly (clang, -O0):
<print_encoded_accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x20(%rbp),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
jge    11a5 <print_encoded_accept+0x85>
mov    -0x20(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x2,%rax
add    $0x1,%rax
add    %rax,%rsi
lea    -0x38(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x30(%rbp),%r9
lea    -0x38(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <print_encoded_mime_type@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1146 <print_encoded_accept+0x26>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_encoded_accept>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x8(%rsp)
mov    %edx,0x4(%rsp)
cmpb   $0x0,(%rcx)
je     119d <print_encoded_accept+0x7d>
mov    %rcx,%rbx
mov    %rsi,%r12
mov    %rdi,%r13
lea    0x1(%rcx),%rbp
xor    %r15d,%r15d
lea    0x14(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    0x4(%rsp),%edx
mov    %r14,%rcx
mov    $0x4,%r8d
mov    0x8(%rsp),%r9
call   1040 <print_encoded_mime_type@plt>
add    $0x1,%r15
movzbl (%rbx),%eax
add    $0x4,%rbp
cmp    %rax,%r15
jb     1160 <print_encoded_accept+0x40>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @print_encoded_accept(i32* %0, i8* %1, i32 %2, i8* %3, i32 %4, i8* %5) {
%7 = alloca i32
%8 = bitcast i32* %7 to i8*
%9 = load i8, i8* %3
%10 = icmp eq i8 %9, 0
br i1 %10, label %22, label %11
11: ; preds = %6, %11
%12 = phi i64 [ %18, %11 ], [ 0, %6 ]
%13 = shl nuw nsw i64 %12, 2
%14 = or i64 %13, 1
%15 = getelementptr inbounds i8, i8* %3, i64 %14
%16 = call i32 @memcpy(i32* %7, i8* %15, i32 4)
%17 = call i32 @print_encoded_mime_type(i32* %0, i8* %1, i32 %2, i32* %7, i32 4, i8* %5)
%18 = add nuw nsw i64 %12, 1
%19 = load i8, i8* %3
%20 = zext i8 %19 to i64
%21 = icmp ult i64 %18, %20
br i1 %21, label %11, label %22
22: ; preds = %11, %6
ret i32 1
}