sudomain(addr) char *addr;
{
  int len;
  char *domain;
  len = strlen(addr);
  if (len < 3 || addr[len - 3] != '.')
    return (0);
  domain = addr + len - 3;
  if (!strcmp(domain, ".su"))
    return (1);
  if (!strcmp(domain, ".ua"))
    return (1);
  if (!strcmp(domain, ".by"))
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<sudomain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jl     115c <sudomain+0x3c>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
je     1168 <sudomain+0x48>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <sudomain+0xd1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
add    $0xfffffffffffffffd,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a0 <sudomain+0x80>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <sudomain+0xd1>
mov    -0x20(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c5 <sudomain+0xa5>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <sudomain+0xd1>
mov    -0x20(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ea <sudomain+0xca>
movl   $0x1,-0x4(%rbp)
jmp    11f1 <sudomain+0xd1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sudomain>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
xor    %ebp,%ebp
cmp    $0x3,%eax
jl     1188 <sudomain+0x68>
lea    -0x3(%rax),%ecx
cmpb   $0x2e,(%rbx,%rcx,1)
jne    1188 <sudomain+0x68>
cltq
lea    (%rbx,%rax,1),%r14
add    $0xfffffffffffffffd,%r14
lea    0xeb3(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1188 <sudomain+0x68>
lea    0xe9f(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1188 <sudomain+0x68>
lea    0xe90(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c".su\00"
@.str.1 = [4 x i8] c".ua\00"
@.str.2 = [4 x i8] c".by\00"
define i32 @sudomain(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = trunc i64 %7 to i32
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %20, label %11
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 46
br i1 %19, label %20, label %21
20: ; preds = %11, %1
store i32 0, i32* %2
br label %42
21: ; preds = %11
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = getelementptr inbounds i8, i8* %25, i64 -3
store i8* %26, i8** %5
%27 = load i8*, i8** %5
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %21
store i32 1, i32* %2
br label %42
31: ; preds = %21
%32 = load i8*, i8** %5
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %31
store i32 1, i32* %2
br label %42
36: ; preds = %31
%37 = load i8*, i8** %5
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %36
store i32 1, i32* %2
br label %42
41: ; preds = %36
store i32 0, i32* %2
br label %42
42: ; preds = %41, %40, %35, %30, %20
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
@.str = [4 x i8] c".su\00"
@.str.1 = [4 x i8] c".ua\00"
@.str.2 = [4 x i8] c".by\00"
define i32 @sudomain(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = icmp slt i32 %3, 3
br i1 %4, label %25, label %5
5: ; preds = %1
%6 = add i64 %2, 4294967293
%7 = and i64 %6, 4294967295
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 46
br i1 %10, label %11, label %25
11: ; preds = %5
%12 = shl i64 %2, 32
%13 = ashr exact i64 %12, 32
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = getelementptr inbounds i8, i8* %14, i64 -3
%16 = tail call i32 @strcmp(i8* %15, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %25, label %18
18: ; preds = %11
%19 = tail call i32 @strcmp(i8* %15, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %18
%22 = tail call i32 @strcmp(i8* %15, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %21, %18, %11, %1, %5
%26 = phi i32 [ 0, %5 ], [ 0, %1 ], [ 1, %11 ], [ 1, %18 ], [ %24, %21 ]
ret i32 %26
}