#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*/ Fatal_Error(char *);
long Extract_Len_String(const char **pointer, int *length, int size,
                        const char **string) {
  int len;
  if (size != 8)
    Fatal_Error("can't use format character 's' with any size except 8.");
  len = 0;
  *string = *pointer;
  while ((len++, --*length, *((*pointer)++)) && *length > 0)
    ;
  return len;
}


x86 assembly (clang, -O0):
<Extract_Len_String>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x8,-0x14(%rbp)
je     113d <Extract_Len_String+0x2d>
lea    0xec8(%rip),%rdi
call   1030 <Fatal_Error@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x25(%rbp)
je     1195 <Extract_Len_String+0x85>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setg   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11a5 <Extract_Len_String+0x95>
jmp    11aa <Extract_Len_String+0x9a>
jmp    1152 <Extract_Len_String+0x42>
movslq -0x24(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Extract_Len_String>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
cmp    $0x8,%edx
je     112f <Extract_Len_String+0x1f>
lea    0xed6(%rip),%rdi
call   1030 <Fatal_Error@plt>
mov    (%rbx),%rax
mov    %rax,(%r15)
mov    (%r14),%edx
mov    (%rbx),%rcx
add    $0x1,%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rdx),%esi
mov    %esi,(%r14)
mov    %rcx,(%rbx)
add    $0x1,%rax
cmpb   $0x0,-0x1(%rcx)
je     116e <Extract_Len_String+0x5e>
add    $0x1,%rcx
cmp    $0x1,%edx
mov    %esi,%edx
jg     1150 <Extract_Len_String+0x40>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [55 x i8] c"can't use format character 's' with any size except 8.\00"
define i64 @Extract_Len_String(i8** %0, i32* %1, i32 %2, i8** %3) {
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
store i8** %0, i8*** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i8** %3, i8*** %8
%10 = load i32, i32* %7
%11 = icmp ne i32 %10, 8
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = call i32 @Fatal_Error(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %4
store i32 0, i32* %9
%15 = load i8**, i8*** %5
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %8
store i8* %16, i8** %17
br label %18
18: ; preds = %36, %14
%19 = load i32, i32* %9
%20 = add nsw i32 %19, 1
store i32 %20, i32* %9
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = add nsw i32 %22, -1
store i32 %23, i32* %21
%24 = load i8**, i8*** %5
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %24
%27 = load i8, i8* %25
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %18
%31 = load i32*, i32** %6
%32 = load i32, i32* %31
%33 = icmp sgt i32 %32, 0
br label %34
34: ; preds = %30, %18
%35 = phi i1 [ false, %18 ], [ %33, %30 ]
br i1 %35, label %36, label %37
36: ; preds = %34
br label %18
37: ; preds = %34
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
ret i64 %39
}

LLVM IR (-O2):
@.str = [55 x i8] c"can't use format character 's' with any size except 8.\00"
define i64 @Extract_Len_String(i8** nocapture %0, i32* nocapture %1, i32 %2, i8** nocapture writeonly %3) {
%5 = icmp eq i32 %2, 8
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @Fatal_Error(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = load i8*, i8** %0
store i8* %9, i8** %3
%10 = load i32, i32* %1
%11 = load i8*, i8** %0
br label %12
12: ; preds = %12, %8
%13 = phi i8* [ %11, %8 ], [ %18, %12 ]
%14 = phi i32 [ %10, %8 ], [ %17, %12 ]
%15 = phi i32 [ 0, %8 ], [ %16, %12 ]
%16 = add nuw nsw i32 %15, 1
%17 = add nsw i32 %14, -1
store i32 %17, i32* %1
%18 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %18, i8** %0
%19 = load i8, i8* %13
%20 = icmp ne i8 %19, 0
%21 = icmp sgt i32 %14, 1
%22 = select i1 %20, i1 %21, i1 false
br i1 %22, label %12, label %23
23: ; preds = %12
%24 = zext i32 %16 to i64
ret i64 %24
}