#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*/ phone_utils_gsm_get_char_size(int);
int utf8_get_next(char const *, int *);
int phone_utils_gsm_is_ucs(const char *string) {
  int i;
  int chr;
  i = 0;
  chr = utf8_get_next(string, &i);
  for (; chr; chr = utf8_get_next(string, &i)) {
    if (!phone_utils_gsm_get_char_size(chr)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<phone_utils_gsm_is_ucs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <utf8_get_next@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1184 <phone_utils_gsm_is_ucs+0x64>
mov    -0x18(%rbp),%edi
call   1040 <phone_utils_gsm_get_char_size@plt>
cmp    $0x0,%eax
jne    116a <phone_utils_gsm_is_ucs+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    118b <phone_utils_gsm_is_ucs+0x6b>
jmp    116f <phone_utils_gsm_is_ucs+0x4f>
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <utf8_get_next@plt>
mov    %eax,-0x18(%rbp)
jmp    1143 <phone_utils_gsm_is_ucs+0x23>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phone_utils_gsm_is_ucs>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
call   1030 <utf8_get_next@plt>
xor    %r14d,%r14d
test   %eax,%eax
je     1172 <phone_utils_gsm_is_ucs+0x52>
lea    0xc(%rsp),%rbp
nopl   0x0(%rax)
mov    %eax,%edi
call   1040 <phone_utils_gsm_get_char_size@plt>
test   %eax,%eax
je     116c <phone_utils_gsm_is_ucs+0x4c>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <utf8_get_next@plt>
test   %eax,%eax
jne    1150 <phone_utils_gsm_is_ucs+0x30>
jmp    1172 <phone_utils_gsm_is_ucs+0x52>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @phone_utils_gsm_is_ucs(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @utf8_get_next(i8* %6, i32* %4)
store i32 %7, i32* %5
br label %8
8: ; preds = %17, %1
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %5
%13 = call i32 @phone_utils_gsm_get_char_size(i32 %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11
store i32 1, i32* %2
br label %21
16: ; preds = %11
br label %17
17: ; preds = %16
%18 = load i8*, i8** %3
%19 = call i32 @utf8_get_next(i8* %18, i32* %4)
store i32 %19, i32* %5
br label %8
20: ; preds = %8
store i32 0, i32* %2
br label %21
21: ; preds = %20, %15
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @phone_utils_gsm_is_ucs(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @utf8_get_next(i8* %0, i32* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %1, %10
%7 = phi i32 [ %11, %10 ], [ %4, %1 ]
%8 = call i32 @phone_utils_gsm_get_char_size(i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = call i32 @utf8_get_next(i8* %0, i32* %2)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %10, %1
%14 = phi i32 [ 0, %1 ], [ 0, %10 ], [ 1, %6 ]
ret i32 %14
}