#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 */
char *strchr(char const *, char);
size_t strlen(char *);
int dpused(const char *str, size_t *dpu) {
  char *c;
  if ((c = strchr(str, '.')) == NULL)
    return 1;
  size_t i, len = strlen(c);
  if (len < 2)
    return 1;
  for (i = len - 1; (i > 0) && (c[i] == '0'); i--)
    ;
  *dpu = i;
  return 0;
}


x86 assembly (clang, -O0):
<dpused>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1158 <dpused+0x38>
movl   $0x1,-0x4(%rbp)
jmp    11e5 <dpused+0xc5>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x2,-0x30(%rbp)
jae    117c <dpused+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    11e5 <dpused+0xc5>
mov    -0x30(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x31(%rbp)
jbe    11ad <dpused+0x8d>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11bd <dpused+0x9d>
jmp    11d3 <dpused+0xb3>
jmp    11c2 <dpused+0xa2>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1188 <dpused+0x68>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dpused>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     1164 <dpused+0x44>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%rax
jb     1164 <dpused+0x44>
add    $0xffffffffffffffff,%rax
mov    %rax,%rcx
sub    $0x1,%rax
jb     115f <dpused+0x3f>
cmpb   $0x30,(%rbx,%rcx,1)
je     1150 <dpused+0x30>
mov    %rcx,(%r14)
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @dpused(i8* %0, i64* nocapture writeonly %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 46)
%4 = icmp eq i8* %3, null
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = tail call i64 @strlen(i8* %3)
%7 = icmp ult i64 %6, 2
br i1 %7, label %17, label %8
8: ; preds = %5, %12
%9 = phi i64 [ %10, %12 ], [ %6, %5 ]
%10 = add i64 %9, -1
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %3, i64 %10
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 48
br i1 %15, label %8, label %16
16: ; preds = %8, %12
store i64 %10, i64* %1
br label %17
17: ; preds = %16, %5, %2
%18 = phi i32 [ 1, %2 ], [ 0, %16 ], [ 1, %5 ]
ret i32 %18
}