#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__ strcmp(char const *, char *);
int strlen(char const *);
int section_name_ends_with_dwo(const char *name) {
  int lenstr = 0;
  int dotpos = 0;
  if (!name) {
    return 0;
  }
  lenstr = strlen(name);
  if (lenstr < 5) {
    return 0;
  }
  dotpos = lenstr - 4;
  if (strcmp(name + dotpos, ".dwo")) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<section_name_ends_with_dwo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1151 <section_name_ends_with_dwo+0x31>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <section_name_ends_with_dwo+0x90>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1173 <section_name_ends_with_dwo+0x53>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <section_name_ends_with_dwo+0x90>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
lea    0xe72(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11a9 <section_name_ends_with_dwo+0x89>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <section_name_ends_with_dwo+0x90>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<section_name_ends_with_dwo>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     1155 <section_name_ends_with_dwo+0x35>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x5,%eax
jl     1155 <section_name_ends_with_dwo+0x35>
add    $0xfffffffc,%eax
add    %rax,%rbx
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".dwo\00"
define i32 @section_name_ends_with_dwo(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 0, i32* %2
br label %26
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 0, i32* %2
br label %26
15: ; preds = %9
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 4
store i32 %17, i32* %5
%18 = load i8*, i8** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %15
store i32 0, i32* %2
br label %26
25: ; preds = %15
store i32 1, i32* %2
br label %26
26: ; preds = %25, %24, %14, %8
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@.str = [5 x i8] c".dwo\00"
define i32 @section_name_ends_with_dwo(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp slt i32 %4, 5
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = add nsw i32 %4, -4
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %12, %6 ]
ret i32 %14
}