#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 */
scalar_t__ match_char(char const **, char const *, char);
scalar_t__ match_dec_octet(char const **, char const *);
int match_ipv4_address(char const **str, char const *end) {
  char const *i = *str;
  if (match_dec_octet(&i, end)) {
    if (match_char(&i, end, '.')) {
      if (match_dec_octet(&i, end)) {
        if (match_char(&i, end, '.')) {
          if (match_dec_octet(&i, end)) {
            if (match_char(&i, end, '.')) {
              if (match_dec_octet(&i, end)) {
                *str = i;
                return 1;
              }
            }
          }
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<match_ipv4_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1030 <match_dec_octet@plt>
cmp    $0x0,%rax
je     1220 <match_ipv4_address+0x100>
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdi
mov    $0x2e,%edx
call   1040 <match_char@plt>
cmp    $0x0,%rax
je     121b <match_ipv4_address+0xfb>
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1030 <match_dec_octet@plt>
cmp    $0x0,%rax
je     1216 <match_ipv4_address+0xf6>
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdi
mov    $0x2e,%edx
call   1040 <match_char@plt>
cmp    $0x0,%rax
je     1211 <match_ipv4_address+0xf1>
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1030 <match_dec_octet@plt>
cmp    $0x0,%rax
je     120c <match_ipv4_address+0xec>
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdi
mov    $0x2e,%edx
call   1040 <match_char@plt>
cmp    $0x0,%rax
je     1207 <match_ipv4_address+0xe7>
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1030 <match_dec_octet@plt>
cmp    $0x0,%rax
je     1202 <match_ipv4_address+0xe2>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1227 <match_ipv4_address+0x107>
jmp    1207 <match_ipv4_address+0xe7>
jmp    120c <match_ipv4_address+0xec>
jmp    1211 <match_ipv4_address+0xf1>
jmp    1216 <match_ipv4_address+0xf6>
jmp    121b <match_ipv4_address+0xfb>
jmp    1220 <match_ipv4_address+0x100>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_ipv4_address>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <match_dec_octet@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     11d5 <match_ipv4_address+0xb5>
lea    0x8(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x2e,%edx
call   1040 <match_char@plt>
test   %rax,%rax
je     11d5 <match_ipv4_address+0xb5>
lea    0x8(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <match_dec_octet@plt>
test   %rax,%rax
je     11d5 <match_ipv4_address+0xb5>
lea    0x8(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x2e,%edx
call   1040 <match_char@plt>
test   %rax,%rax
je     11d5 <match_ipv4_address+0xb5>
lea    0x8(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <match_dec_octet@plt>
test   %rax,%rax
je     11d5 <match_ipv4_address+0xb5>
lea    0x8(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x2e,%edx
call   1040 <match_char@plt>
test   %rax,%rax
je     11d5 <match_ipv4_address+0xb5>
lea    0x8(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <match_dec_octet@plt>
test   %rax,%rax
je     11d5 <match_ipv4_address+0xb5>
mov    0x8(%rsp),%rax
mov    %rax,(%rbx)
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @match_ipv4_address(i8** %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
store i8** %0, i8*** %4
store i8* %1, i8** %5
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = call i64 @match_dec_octet(i8** %6, i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %45
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i64 @match_char(i8** %6, i8* %13, i8 signext 46)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %44
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = call i64 @match_dec_octet(i8** %6, i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %43
20: ; preds = %16
%21 = load i8*, i8** %5
%22 = call i64 @match_char(i8** %6, i8* %21, i8 signext 46)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %42
24: ; preds = %20
%25 = load i8*, i8** %5
%26 = call i64 @match_dec_octet(i8** %6, i8* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %41
28: ; preds = %24
%29 = load i8*, i8** %5
%30 = call i64 @match_char(i8** %6, i8* %29, i8 signext 46)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %28
%33 = load i8*, i8** %5
%34 = call i64 @match_dec_octet(i8** %6, i8* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i8*, i8** %6
%38 = load i8**, i8*** %4
store i8* %37, i8** %38
store i32 1, i32* %3
br label %46
39: ; preds = %32
br label %40
40: ; preds = %39, %28
br label %41
41: ; preds = %40, %24
br label %42
42: ; preds = %41, %20
br label %43
43: ; preds = %42, %16
br label %44
44: ; preds = %43, %12
br label %45
45: ; preds = %44, %2
store i32 0, i32* %3
br label %46
46: ; preds = %45, %36
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
define i32 @match_ipv4_address(i8** nocapture %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = load i8*, i8** %0
store i8* %5, i8** %3
%6 = call i64 @match_dec_octet(i8** %3, i8* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %28, label %8
8: ; preds = %2
%9 = call i64 @match_char(i8** %3, i8* %1, i8 signext 46)
%10 = icmp eq i64 %9, 0
br i1 %10, label %28, label %11
11: ; preds = %8
%12 = call i64 @match_dec_octet(i8** %3, i8* %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %28, label %14
14: ; preds = %11
%15 = call i64 @match_char(i8** %3, i8* %1, i8 signext 46)
%16 = icmp eq i64 %15, 0
br i1 %16, label %28, label %17
17: ; preds = %14
%18 = call i64 @match_dec_octet(i8** %3, i8* %1)
%19 = icmp eq i64 %18, 0
br i1 %19, label %28, label %20
20: ; preds = %17
%21 = call i64 @match_char(i8** %3, i8* %1, i8 signext 46)
%22 = icmp eq i64 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %20
%24 = call i64 @match_dec_octet(i8** %3, i8* %1)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = load i8*, i8** %3
store i8* %27, i8** %0
br label %28
28: ; preds = %2, %11, %17, %23, %20, %14, %8, %26
%29 = phi i32 [ 1, %26 ], [ 0, %8 ], [ 0, %14 ], [ 0, %20 ], [ 0, %23 ], [ 0, %17 ], [ 0, %11 ], [ 0, %2 ]
ret i32 %29
}