#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 get_line(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int get_mydef(char *pin, char *w) {
  int c1, c2, l, len;
  char tmp[250];
  tmp[0] = '\0';
  len = 1;
  while (*pin != '\0') {
    c1 = *pin;
    c2 = *++pin;
    --pin;
    if (c1 == '.' && c2 == '.')
      break;
    l = get_line(pin, tmp, 1);
    strcat(w, tmp);
    len += l + 1;
    pin += l + 1;
  }
  return (len);
}


x86 assembly (clang, -O0):
<get_mydef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x120(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11e3 <get_mydef+0xc3>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl 0x1(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
cmpl   $0x2e,-0x14(%rbp)
jne    1196 <get_mydef+0x76>
cmpl   $0x2e,-0x18(%rbp)
jne    1196 <get_mydef+0x76>
jmp    11e3 <get_mydef+0xc3>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
mov    $0x1,%edx
call   1030 <get_line@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1141 <get_mydef+0x21>
mov    -0x20(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mydef>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
movb   $0x0,(%rsp)
mov    (%rdi),%cl
test   %cl,%cl
je     119a <get_mydef+0x7a>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x1,%r12d
mov    %rsp,%r15
jmp    118a <get_mydef+0x6a>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1030 <get_line@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
movslq %ebp,%rdx
lea    0x1(%rdx),%rax
add    %r12d,%eax
movzbl 0x1(%rbx,%rdx,1),%ecx
add    %rdx,%rbx
add    $0x1,%rbx
mov    %eax,%r12d
test   %cl,%cl
je     119f <get_mydef+0x7f>
cmp    $0x2e,%cl
jne    1150 <get_mydef+0x30>
cmpb   $0x2e,0x1(%rbx)
jne    1150 <get_mydef+0x30>
mov    %r12d,%eax
jmp    119f <get_mydef+0x7f>
mov    $0x1,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_mydef(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [250 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%10 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
store i8 0, i8* %10
store i32 1, i32* %8
br label %11
11: ; preds = %32, %2
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %48
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
store i32 %19, i32* %5
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
store i32 %23, i32* %6
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 -1
store i8* %25, i8** %3
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 46
br i1 %27, label %28, label %32
28: ; preds = %16
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 46
br i1 %30, label %31, label %32
31: ; preds = %28
br label %48
32: ; preds = %28, %16
%33 = load i8*, i8** %3
%34 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%35 = call i32 @get_line(i8* %33, i8* %34, i32 1)
store i32 %35, i32* %7
%36 = load i8*, i8** %4
%37 = getelementptr inbounds [250 x i8], [250 x i8]* %9, i64 0, i64 0
%38 = call i32 @strcat(i8* %36, i8* %37)
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
%41 = load i32, i32* %8
%42 = add nsw i32 %41, %40
store i32 %42, i32* %8
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
%45 = load i8*, i8** %3
%46 = sext i32 %44 to i64
%47 = getelementptr inbounds i8, i8* %45, i64 %46
store i8* %47, i8** %3
br label %11
48: ; preds = %31, %11
%49 = load i32, i32* %8
ret i32 %49
}

LLVM IR (-O2):
define i32 @get_mydef(i8* %0, i8* %1) {
%3 = alloca [250 x i8]
%4 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
store i8 0, i8* %4
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %25, label %7
7: ; preds = %2, %16
%8 = phi i8 [ %23, %16 ], [ %5, %2 ]
%9 = phi i32 [ %20, %16 ], [ 1, %2 ]
%10 = phi i8* [ %22, %16 ], [ %0, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %8, 46
%14 = icmp eq i8 %12, 46
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %25, label %16
16: ; preds = %7
%17 = call i32 @get_line(i8* %10, i8* %4, i32 1)
%18 = call i32 @strcat(i8* %1, i8* %4)
%19 = add nsw i32 %17, 1
%20 = add nsw i32 %19, %9
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds i8, i8* %10, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %7
25: ; preds = %16, %7, %2
%26 = phi i32 [ 1, %2 ], [ %9, %7 ], [ %20, %16 ]
ret i32 %26
}