#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 *);
char *strextract_domain(char *in) {
  int i = 0;
  for (i = 0; i < strlen(in) - 1; i++) {
    if (in[i] == '@') {
      return (char *)(&in[i + 1]);
    }
  }
  return (char *)-1;
}


x86 assembly (clang, -O0):
<strextract_domain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    118a <strextract_domain+0x7a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x40,%eax
jne    1177 <strextract_domain+0x67>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1195 <strextract_domain+0x85>
jmp    117c <strextract_domain+0x6c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112a <strextract_domain+0x1a>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strextract_domain>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    $0xffffffffffffffff,%r14
cmp    $0x2,%eax
jl     1157 <strextract_domain+0x47>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
cmpb   $0x40,(%r15,%rbx,1)
je     114f <strextract_domain+0x3f>
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%rbx
jl     1130 <strextract_domain+0x20>
jmp    1157 <strextract_domain+0x47>
lea    (%r15,%rbx,1),%r14
add    $0x1,%r14
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strextract_domain(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %4
br label %5
5: ; preds = %26, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 1
%10 = icmp slt i32 %6, %9
br i1 %10, label %11, label %29
11: ; preds = %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 64
br i1 %18, label %19, label %25
19: ; preds = %11
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
store i8* %24, i8** %2
br label %30
25: ; preds = %11
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %5
29: ; preds = %5
store i8* inttoptr (i64 -1 to i8*), i8** %2
br label %30
30: ; preds = %29, %19
%31 = load i8*, i8** %2
ret i8* %31
}

LLVM IR (-O2):
define i8* @strextract_domain(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 1
br i1 %3, label %4, label %18
4: ; preds = %1, %13
%5 = phi i64 [ %9, %13 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 64
%9 = add nuw nsw i64 %5, 1
br i1 %8, label %10, label %13
10: ; preds = %4
%11 = and i64 %9, 4294967295
%12 = getelementptr inbounds i8, i8* %0, i64 %11
br label %18
13: ; preds = %4
%14 = tail call i32 @strlen(i8* %0)
%15 = add nsw i32 %14, -1
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %9, %16
br i1 %17, label %4, label %18
18: ; preds = %13, %1, %10
%19 = phi i8* [ %12, %10 ], [ inttoptr (i64 -1 to i8*), %1 ], [ inttoptr (i64 -1 to i8*), %13 ]
ret i8* %19
}