#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 strlen(char *);
int ends_with_punctuation(char *string) {
  switch (string[strlen(string) - 1]) {
  case '.':
  case '!':
  case ':':
  case ',':
  case '?':
  case ')':
  case ']':
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ends_with_punctuation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    %rdi,-0x20(%rbp)
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
add    $0xffffffff,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
sub    $0x21,%eax
je     11b0 <ends_with_punctuation+0xa0>
jmp    114a <ends_with_punctuation+0x3a>
mov    -0x14(%rbp),%eax
sub    $0x29,%eax
je     11b0 <ends_with_punctuation+0xa0>
jmp    115b <ends_with_punctuation+0x4b>
mov    -0x14(%rbp),%eax
sub    $0x2c,%eax
je     11b0 <ends_with_punctuation+0xa0>
jmp    116c <ends_with_punctuation+0x5c>
mov    -0x14(%rbp),%eax
sub    $0x2e,%eax
je     11b0 <ends_with_punctuation+0xa0>
jmp    117d <ends_with_punctuation+0x6d>
mov    -0x14(%rbp),%eax
sub    $0x3a,%eax
je     11b0 <ends_with_punctuation+0xa0>
jmp    118e <ends_with_punctuation+0x7e>
mov    -0x14(%rbp),%eax
sub    $0x3f,%eax
je     11b0 <ends_with_punctuation+0xa0>
jmp    119f <ends_with_punctuation+0x8f>
mov    -0x14(%rbp),%eax
sub    $0x5d,%eax
jne    11bc <ends_with_punctuation+0xac>
jmp    11b0 <ends_with_punctuation+0xa0>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <ends_with_punctuation+0xb3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ends_with_punctuation>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
movsbl -0x1(%rax,%rbx,1),%ecx
add    $0xffffffdf,%ecx
cmp    $0x3c,%ecx
ja     113f <ends_with_punctuation+0x2f>
mov    $0x1,%eax
movabs $0x1000000042002901,%rdx
bt     %rcx,%rdx
jae    113f <ends_with_punctuation+0x2f>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ends_with_punctuation(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strlen(i8* %5)
%7 = sub nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %4, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
switch i32 %11, label %13 [
i32 46, label %12
i32 33, label %12
i32 58, label %12
i32 44, label %12
i32 63, label %12
i32 41, label %12
i32 93, label %12
]
12: ; preds = %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @ends_with_punctuation(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %8 [
i32 46, label %9
i32 33, label %9
i32 58, label %9
i32 44, label %9
i32 63, label %9
i32 41, label %9
i32 93, label %9
]
8: ; preds = %1
br label %9
9: ; preds = %1, %1, %1, %1, %1, %1, %1, %8
%10 = phi i32 [ 0, %8 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %10
}