void test_unary_extensions(void) {
  char buf[][20] = {
      "file.jpg",
      "program-1.0.zip",
      "tar.zip",
  };
  do {
    seatest_assert_string_equal("jpg", cut_extension(buf[0]), __FUNCTION__, 22);
  } while (0);
  do {
    seatest_assert_string_equal("file", buf[0], __FUNCTION__, 23);
  } while (0);
  do {
    seatest_assert_string_equal("zip", cut_extension(buf[1]), __FUNCTION__, 24);
  } while (0);
  do {
    seatest_assert_string_equal("program-1.0", buf[1], __FUNCTION__, 25);
  } while (0);
  do {
    seatest_assert_string_equal("zip", cut_extension(buf[2]), __FUNCTION__, 26);
  } while (0);
  do {
    seatest_assert_string_equal("tar", buf[2], __FUNCTION__, 27);
  } while (0);
}


x86 assembly (clang, -O0):
<test_unary_extensions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x3c,%edx
call   1030 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1050 <cut_extension@plt>
mov    %eax,%esi
lea    0xedb(%rip),%rdi
lea    0xed8(%rip),%rdx
mov    $0x16,%ecx
mov    $0x0,%al
call   1040 <seatest_assert_string_equal@plt>
jmp    1179 <test_unary_extensions+0x49>
lea    -0x40(%rbp),%rsi
lea    0xed2(%rip),%rdi
lea    0xeb5(%rip),%rdx
mov    $0x17,%ecx
mov    $0x0,%al
call   1040 <seatest_assert_string_equal@plt>
jmp    119c <test_unary_extensions+0x6c>
lea    -0x40(%rbp),%rdi
add    $0x14,%rdi
mov    $0x0,%al
call   1050 <cut_extension@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
lea    0xe85(%rip),%rdx
mov    $0x18,%ecx
mov    $0x0,%al
call   1040 <seatest_assert_string_equal@plt>
jmp    11cc <test_unary_extensions+0x9c>
lea    -0x40(%rbp),%rsi
add    $0x14,%rsi
lea    0xe84(%rip),%rdi
lea    0xe5e(%rip),%rdx
mov    $0x19,%ecx
mov    $0x0,%al
call   1040 <seatest_assert_string_equal@plt>
jmp    11f3 <test_unary_extensions+0xc3>
lea    -0x40(%rbp),%rdi
add    $0x28,%rdi
mov    $0x0,%al
call   1050 <cut_extension@plt>
mov    %eax,%esi
lea    0xe50(%rip),%rdi
lea    0xe2e(%rip),%rdx
mov    $0x1a,%ecx
mov    $0x0,%al
call   1040 <seatest_assert_string_equal@plt>
jmp    1223 <test_unary_extensions+0xf3>
lea    -0x40(%rbp),%rsi
add    $0x28,%rsi
lea    0xe39(%rip),%rdi
lea    0xe07(%rip),%rdx
mov    $0x1b,%ecx
mov    $0x0,%al
call   1040 <seatest_assert_string_equal@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unary_extensions>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
movups 0xefc(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <cut_extension@plt>
lea    0xed0(%rip),%rdi
lea    0xecd(%rip),%rbx
mov    %eax,%esi
mov    %rbx,%rdx
mov    $0x16,%ecx
xor    %eax,%eax
call   1030 <seatest_assert_string_equal@plt>
lea    0xecb(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x17,%ecx
xor    %eax,%eax
call   1030 <seatest_assert_string_equal@plt>
lea    0x14(%rsp),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <cut_extension@plt>
lea    0xea8(%rip),%r15
mov    %r15,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
mov    $0x18,%ecx
xor    %eax,%eax
call   1030 <seatest_assert_string_equal@plt>
lea    0xe91(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x19,%ecx
xor    %eax,%eax
call   1030 <seatest_assert_string_equal@plt>
lea    0x28(%rsp),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <cut_extension@plt>
mov    %r15,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
mov    $0x1a,%ecx
xor    %eax,%eax
call   1030 <seatest_assert_string_equal@plt>
lea    0xe61(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x1b,%ecx
xor    %eax,%eax
call   1030 <seatest_assert_string_equal@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.test_unary_extensions.buf = [3 x [20 x i8]] [[20 x i8] c"file.jpg\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"program-1.0.zip\00\00\00\00\00", [20 x i8] c"tar.zip\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str = [4 x i8] c"jpg\00"
@__FUNCTION__.test_unary_extensions = [22 x i8] c"test_unary_extensions\00"
@.str.1 = [5 x i8] c"file\00"
@.str.2 = [4 x i8] c"zip\00"
@.str.3 = [12 x i8] c"program-1.0\00"
@.str.4 = [4 x i8] c"tar\00"
define void @test_unary_extensions() {
%1 = alloca [3 x [20 x i8]]
%2 = bitcast [3 x [20 x i8]]* %1 to i8*
br label %3
3: ; preds = %0
%4 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @cut_extension to i32 (i8*, ...)*)(i8* %5)
%7 = call i32 (i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i32, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 22)
br label %8
8: ; preds = %3
br label %9
9: ; preds = %8
%10 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 0
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%12 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 23)
br label %13
13: ; preds = %9
br label %14
14: ; preds = %13
%15 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 1
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %15, i64 0, i64 0
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @cut_extension to i32 (i8*, ...)*)(i8* %16)
%18 = call i32 (i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i32, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 24)
br label %19
19: ; preds = %14
br label %20
20: ; preds = %19
%21 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 1
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %21, i64 0, i64 0
%23 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 25)
br label %24
24: ; preds = %20
br label %25
25: ; preds = %24
%26 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 2
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %26, i64 0, i64 0
%28 = call i32 (i8*, ...) bitcast (i32 (...)* @cut_extension to i32 (i8*, ...)*)(i8* %27)
%29 = call i32 (i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i32, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %28, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 26)
br label %30
30: ; preds = %25
br label %31
31: ; preds = %30
%32 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 2
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %32, i64 0, i64 0
%34 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %33, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 27)
br label %35
35: ; preds = %31
ret void
}

LLVM IR (-O2):
@__const.test_unary_extensions.buf = [3 x [20 x i8]] [[20 x i8] c"file.jpg\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"program-1.0.zip\00\00\00\00\00", [20 x i8] c"tar.zip\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str = [4 x i8] c"jpg\00"
@__FUNCTION__.test_unary_extensions = [22 x i8] c"test_unary_extensions\00"
@.str.1 = [5 x i8] c"file\00"
@.str.2 = [4 x i8] c"zip\00"
@.str.3 = [12 x i8] c"program-1.0\00"
@.str.4 = [4 x i8] c"tar\00"
define void @test_unary_extensions() {
%1 = alloca [3 x [20 x i8]]
%2 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 0, i64 0
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @cut_extension to i32 (i8*, ...)*)(i8* %2)
%4 = call i32 (i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i32, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 22)
%5 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 23)
%6 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 1, i64 0
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @cut_extension to i32 (i8*, ...)*)(i8* %6)
%8 = call i32 (i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i32, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 24)
%9 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 25)
%10 = getelementptr inbounds [3 x [20 x i8]], [3 x [20 x i8]]* %1, i64 0, i64 2, i64 0
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @cut_extension to i32 (i8*, ...)*)(i8* %10)
%12 = call i32 (i8*, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i32, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 26)
%13 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.test_unary_extensions, i64 0, i64 0), i32 27)
ret void
}