#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*/ error(char *);
int strlen(char *);
void init_bounds(char *list[], int *ptr_l, int *ptr_max) {
  int max = 0;
  int l = 0;
  int relmax = 0;
  while (list[l] != NULL) {
    relmax = strlen(list[l]);
    if (relmax > max)
      max = relmax;
    l++;
    if (l >= 100)
      error("init_bounds: someone did not NULL terminate the list...");
  }
  *ptr_l = l;
  *ptr_max = max;
}


x86 assembly (clang, -O0):
<init_bounds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11a6 <init_bounds+0x86>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1182 <init_bounds+0x62>
mov    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x64,-0x20(%rbp)
jl     11a1 <init_bounds+0x81>
lea    0xe64(%rip),%rdi
call   1040 <error@plt>
jmp    1149 <init_bounds+0x29>
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_bounds>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1178 <init_bounds+0x58>
xor    %ebx,%ebx
lea    0xebb(%rip),%r12
xor    %ebp,%ebp
jmp    115e <init_bounds+0x3e>
nopl   0x0(%rax)
mov    0x8(%r13,%rbx,8),%rdi
add    $0x1,%rbx
test   %rdi,%rdi
je     117c <init_bounds+0x5c>
call   1030 <strlen@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    $0x63,%rbx
jb     1150 <init_bounds+0x30>
mov    %r12,%rdi
call   1040 <error@plt>
jmp    1150 <init_bounds+0x30>
xor    %ebp,%ebp
xor    %ebx,%ebx
mov    %ebx,(%r15)
mov    %ebp,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"init_bounds: someone did not NULL terminate the list...\00"
define void @init_bounds(i8** %0, i32* %1, i32* %2) {
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8** %0, i8*** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %36, %3
%11 = load i8**, i8*** %4
%12 = load i32, i32* %8
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %37
17: ; preds = %10
%18 = load i8**, i8*** %4
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @strlen(i8* %22)
store i32 %23, i32* %9
%24 = load i32, i32* %9
%25 = load i32, i32* %7
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %17
%28 = load i32, i32* %9
store i32 %28, i32* %7
br label %29
29: ; preds = %27, %17
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = icmp sge i32 %32, 100
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = call i32 @error(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
br label %36
36: ; preds = %34, %29
br label %10
37: ; preds = %10
%38 = load i32, i32* %8
%39 = load i32*, i32** %5
store i32 %38, i32* %39
%40 = load i32, i32* %7
%41 = load i32*, i32** %6
store i32 %40, i32* %41
ret void
}

LLVM IR (-O2):
@.str = [56 x i8] c"init_bounds: someone did not NULL terminate the list...\00"
define void @init_bounds(i8** nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %23, label %6
6: ; preds = %3, %17
%7 = phi i64 [ %13, %17 ], [ 0, %3 ]
%8 = phi i8* [ %19, %17 ], [ %4, %3 ]
%9 = phi i32 [ %12, %17 ], [ 0, %3 ]
%10 = tail call i32 @strlen(i8* %8)
%11 = icmp sgt i32 %10, %9
%12 = select i1 %11, i32 %10, i32 %9
%13 = add nuw i64 %7, 1
%14 = icmp ugt i64 %7, 98
br i1 %14, label %15, label %17
15: ; preds = %6
%16 = tail call i32 @error(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %6
%18 = getelementptr inbounds i8*, i8** %0, i64 %13
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %6
21: ; preds = %17
%22 = trunc i64 %13 to i32
br label %23
23: ; preds = %21, %3
%24 = phi i32 [ 0, %3 ], [ %12, %21 ]
%25 = phi i32 [ 0, %3 ], [ %22, %21 ]
store i32 %25, i32* %1
store i32 %24, i32* %2
ret void
}