#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 atoi(char *);
int coffset(char *str) {
  register char *p;
  for (p = str; *p && *p != '.'; ++p)
    ;
  return (*p ? atoi(p + 1) - atoi(str) : atoi(str));
}


x86 assembly (clang, -O0):
<coffset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1149 <coffset+0x39>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1159 <coffset+0x49>
jmp    116f <coffset+0x5f>
jmp    115e <coffset+0x4e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <coffset+0x14>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a7 <coffset+0x97>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
jmp    11b3 <coffset+0xa3>
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coffset>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
movzbl -0x1(%rdi),%eax
test   %al,%al
je     1132 <coffset+0x22>
cmp    $0x2e,%al
je     1140 <coffset+0x30>
add    $0x1,%rdi
jmp    1120 <coffset+0x10>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <atoi@plt>
call   1030 <atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <atoi@plt>
sub    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @coffset(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %18, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 46
br label %15
15: ; preds = %10, %5
%16 = phi i1 [ false, %5 ], [ %14, %10 ]
br i1 %16, label %17, label %21
17: ; preds = %15
br label %18
18: ; preds = %17
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %5
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %33
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = call i32 @atoi(i8* %28)
%30 = load i8*, i8** %2
%31 = call i32 @atoi(i8* %30)
%32 = sub nsw i32 %29, %31
br label %36
33: ; preds = %21
%34 = load i8*, i8** %2
%35 = call i32 @atoi(i8* %34)
br label %36
36: ; preds = %33, %26
%37 = phi i32 [ %32, %26 ], [ %35, %33 ]
ret i32 %37
}

LLVM IR (-O2):
define i32 @coffset(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %12
i8 46, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 1
%9 = tail call i32 @atoi(i8* %8)
%10 = tail call i32 @atoi(i8* %0)
%11 = sub nsw i32 %9, %10
br label %14
12: ; preds = %2
%13 = tail call i32 @atoi(i8* %0)
br label %14
14: ; preds = %12, %7
%15 = phi i32 [ %11, %7 ], [ %13, %12 ]
ret i32 %15
}