#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*/ uint32_t;
struct harbor {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _request_master(struct harbor *, char const *, int,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ _update_remote_name(struct harbor *, char const *,
                                       int /*<<< orphan*/);
void _remote_register_name(struct harbor *h, const char name[16],
                           uint32_t handle) {
  int i;
  for (i = 0; i < 16; i++) {
    if (name[i] == '\0')
      break;
  }
  if (handle != 0) {
    _update_remote_name(h, name, handle);
  }
  _request_master(h, name, i, handle);
}


x86 assembly (clang, -O0):
<_remote_register_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x10,-0x18(%rbp)
jge    1171 <_remote_register_name+0x51>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    115e <_remote_register_name+0x3e>
jmp    1171 <_remote_register_name+0x51>
jmp    1163 <_remote_register_name+0x43>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <_remote_register_name+0x1a>
cmpl   $0x0,-0x14(%rbp)
je     118b <_remote_register_name+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <_update_remote_name@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <_request_master@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_remote_register_name>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
cmpb   $0x0,(%rsi)
je     1198 <_remote_register_name+0x78>
cmpb   $0x0,0x1(%rbx)
je     119d <_remote_register_name+0x7d>
cmpb   $0x0,0x2(%rbx)
je     11a5 <_remote_register_name+0x85>
cmpb   $0x0,0x3(%rbx)
je     11ad <_remote_register_name+0x8d>
cmpb   $0x0,0x4(%rbx)
je     11b5 <_remote_register_name+0x95>
cmpb   $0x0,0x5(%rbx)
je     11bd <_remote_register_name+0x9d>
cmpb   $0x0,0x6(%rbx)
je     11c5 <_remote_register_name+0xa5>
cmpb   $0x0,0x7(%rbx)
je     11cd <_remote_register_name+0xad>
cmpb   $0x0,0x8(%rbx)
je     11d5 <_remote_register_name+0xb5>
cmpb   $0x0,0x9(%rbx)
je     11dd <_remote_register_name+0xbd>
cmpb   $0x0,0xa(%rbx)
je     11e5 <_remote_register_name+0xc5>
cmpb   $0x0,0xb(%rbx)
je     11ed <_remote_register_name+0xcd>
cmpb   $0x0,0xc(%rbx)
je     11f5 <_remote_register_name+0xd5>
cmpb   $0x0,0xd(%rbx)
je     11fd <_remote_register_name+0xdd>
cmpb   $0x0,0xe(%rbx)
je     1205 <_remote_register_name+0xe5>
cmpb   $0x1,0xf(%rbx)
mov    $0x10,%r15d
sbb    $0x0,%r15d
jmp    120b <_remote_register_name+0xeb>
xor    %r15d,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x1,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x2,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x3,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x4,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x5,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x6,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x7,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x8,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0x9,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0xa,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0xb,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0xc,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0xd,%r15d
jmp    120b <_remote_register_name+0xeb>
mov    $0xe,%r15d
test   %ebp,%ebp
je     121c <_remote_register_name+0xfc>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <_update_remote_name@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <_request_master@plt>

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

LLVM IR (-O2):
%struct.harbor = type { i32 }
define void @_remote_register_name(%struct.harbor* %0, i8* %1, i32 %2) {
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %67, label %6
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %1, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %67, label %10
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %67, label %14
14: ; preds = %10
%15 = getelementptr inbounds i8, i8* %1, i64 3
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %67, label %18
18: ; preds = %14
%19 = getelementptr inbounds i8, i8* %1, i64 4
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %67, label %22
22: ; preds = %18
%23 = getelementptr inbounds i8, i8* %1, i64 5
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %67, label %26
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %1, i64 6
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %67, label %30
30: ; preds = %26
%31 = getelementptr inbounds i8, i8* %1, i64 7
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %67, label %34
34: ; preds = %30
%35 = getelementptr inbounds i8, i8* %1, i64 8
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %67, label %38
38: ; preds = %34
%39 = getelementptr inbounds i8, i8* %1, i64 9
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %67, label %42
42: ; preds = %38
%43 = getelementptr inbounds i8, i8* %1, i64 10
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 0
br i1 %45, label %67, label %46
46: ; preds = %42
%47 = getelementptr inbounds i8, i8* %1, i64 11
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 0
br i1 %49, label %67, label %50
50: ; preds = %46
%51 = getelementptr inbounds i8, i8* %1, i64 12
%52 = load i8, i8* %51
%53 = icmp eq i8 %52, 0
br i1 %53, label %67, label %54
54: ; preds = %50
%55 = getelementptr inbounds i8, i8* %1, i64 13
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 0
br i1 %57, label %67, label %58
58: ; preds = %54
%59 = getelementptr inbounds i8, i8* %1, i64 14
%60 = load i8, i8* %59
%61 = icmp eq i8 %60, 0
br i1 %61, label %67, label %62
62: ; preds = %58
%63 = getelementptr inbounds i8, i8* %1, i64 15
%64 = load i8, i8* %63
%65 = icmp eq i8 %64, 0
%66 = select i1 %65, i32 15, i32 16
br label %67
67: ; preds = %62, %58, %54, %50, %46, %42, %38, %34, %30, %26, %22, %18, %14, %10, %6, %3
%68 = phi i32 [ 0, %3 ], [ 1, %6 ], [ 2, %10 ], [ 3, %14 ], [ 4, %18 ], [ 5, %22 ], [ 6, %26 ], [ 7, %30 ], [ 8, %34 ], [ 9, %38 ], [ 10, %42 ], [ 11, %46 ], [ 12, %50 ], [ 13, %54 ], [ 14, %58 ], [ %66, %62 ]
%69 = icmp eq i32 %2, 0
br i1 %69, label %72, label %70
70: ; preds = %67
%71 = tail call i32 @_update_remote_name(%struct.harbor* %0, i8* %1, i32 %2)
br label %72
72: ; preds = %70, %67
%73 = tail call i32 @_request_master(%struct.harbor* %0, i8* %1, i32 %68, i32 %2)
ret void
}