int ar_touch(name)
char *name;
{
  register char *p, *arname, *memname;
  register int val;
  p = index(name, '(');
  arname = savestring(name, p - name);
  val = strlen(p) - 2;
  if (val > 15)
    val = 15;
  memname = savestring(p + 1, val);
  p = rindex(memname, ')');
  if (p != 0)
    *p = '\0';
  (void)f_mtime(enter_file(arname));
  val = 1;
  switch (ar_member_touch(arname, memname)) {
  case -1:
    error("touch: Archive `%s' does not exist", arname);
    break;
  case -2:
    error("touch: `%s' is not a valid archive", arname);
  case -3:
    perror_with_name("touch: ", arname);
    break;
  case 1:
    error("touch: Member `%s' does not exist in `%s'", memname, arname);
    break;
  case 0:
    val = 0;
    break;
  default:
    error("touch: Bad return code from ar_member_touch on `%s'", name);
  }
  free(arname);
  free(memname);
  return val;
}


x86 assembly (clang, -O0):
<ar_touch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x28,%esi
call   1090 <index@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
sub    %rax,%rsi
mov    $0x0,%al
call   1050 <savestring@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x2,%rax
mov    %eax,-0x24(%rbp)
cmpl   $0xf,-0x24(%rbp)
jle    11fb <ar_touch+0x5b>
movl   $0xf,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x24(%rbp),%esi
mov    $0x0,%al
call   1050 <savestring@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x29,%esi
call   10c0 <rindex@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1237 <ar_touch+0x97>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %al,-0x31(%rbp)
call   10a0 <enter_file@plt>
mov    %eax,%edi
mov    -0x31(%rbp),%al
call   1040 <f_mtime@plt>
mov    -0x31(%rbp),%al
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <ar_member_touch@plt>
add    $0x3,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x4,%eax
ja     12f3 <ar_touch+0x153>
mov    -0x30(%rbp),%rax
lea    0xd7d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rsi
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   10b0 <error@plt>
jmp    1305 <ar_touch+0x165>
mov    -0x18(%rbp),%rsi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   10b0 <error@plt>
mov    -0x18(%rbp),%rsi
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1070 <perror_with_name@plt>
jmp    1305 <ar_touch+0x165>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   10b0 <error@plt>
jmp    1305 <ar_touch+0x165>
movl   $0x0,-0x24(%rbp)
jmp    1305 <ar_touch+0x165>
mov    -0x8(%rbp),%rsi
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   10b0 <error@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ar_touch>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
mov    $0x28,%esi
call   1090 <index@plt>
mov    %rax,%rbx
mov    %rax,%rsi
sub    %r12,%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <savestring@plt>
movslq %eax,%r15
mov    %rbx,%rdi
call   1060 <strlen@plt>
add    $0xfffffffe,%eax
cmp    $0xf,%eax
mov    $0xf,%esi
cmovl  %eax,%esi
add    $0x1,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <savestring@plt>
movslq %eax,%r14
mov    %r14,%rdi
mov    $0x29,%esi
call   10c0 <rindex@plt>
test   %rax,%rax
je     1207 <ar_touch+0x67>
movb   $0x0,(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   10a0 <enter_file@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1040 <f_mtime@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <ar_member_touch@plt>
mov    %eax,%ebx
lea    0x3(%rbx),%eax
cmp    $0x4,%eax
ja     1265 <ar_touch+0xc5>
lea    0xdc8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xdef(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10b0 <error@plt>
lea    0xe01(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <perror_with_name@plt>
jmp    1298 <ar_touch+0xf8>
lea    0xe20(%rip),%rdi
mov    %r12,%rsi
jmp    127b <ar_touch+0xdb>
lea    0xd9c(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10b0 <error@plt>
jmp    1298 <ar_touch+0xf8>
lea    0xdd7(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10b0 <error@plt>
mov    $0x1,%ebx
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"touch: Archive `%s' does not exist\00"
@.str.1 = [35 x i8] c"touch: `%s' is not a valid archive\00"
@.str.2 = [8 x i8] c"touch: \00"
@.str.3 = [42 x i8] c"touch: Member `%s' does not exist in `%s'\00"
@.str.4 = [52 x i8] c"touch: Bad return code from ar_member_touch on `%s'\00"
define i32 @ar_touch(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i8* @index(i8* %7, i32 40)
store i8* %8, i8** %3
%9 = load i8*, i8** %2
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = ptrtoint i8* %10 to i64
%13 = ptrtoint i8* %11 to i64
%14 = sub i64 %12, %13
%15 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @savestring to i32 (i8*, i64, ...)*)(i8* %9, i64 %14)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %4
%18 = load i8*, i8** %3
%19 = call i64 @strlen(i8* %18)
%20 = sub i64 %19, 2
%21 = trunc i64 %20 to i32
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp sgt i32 %22, 15
br i1 %23, label %24, label %25
24: ; preds = %1
store i32 15, i32* %6
br label %25
25: ; preds = %24, %1
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i32, i32* %6
%29 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @savestring to i32 (i8*, i32, ...)*)(i8* %27, i32 %28)
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i8*
store i8* %31, i8** %5
%32 = load i8*, i8** %5
%33 = call i8* @rindex(i8* %32, i32 41)
store i8* %33, i8** %3
%34 = load i8*, i8** %3
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %38
36: ; preds = %25
%37 = load i8*, i8** %3
store i8 0, i8* %37
br label %38
38: ; preds = %36, %25
%39 = load i8*, i8** %4
%40 = call i32 (i8*, ...) bitcast (i32 (...)* @enter_file to i32 (i8*, ...)*)(i8* %39)
%41 = call i32 (i32, ...) bitcast (i32 (...)* @f_mtime to i32 (i32, ...)*)(i32 %40)
store i32 1, i32* %6
%42 = load i8*, i8** %4
%43 = load i8*, i8** %5
%44 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @ar_member_touch to i32 (i8*, i8*, ...)*)(i8* %42, i8* %43)
switch i32 %44, label %59 [
i32 -1, label %45
i32 -2, label %48
i32 -3, label %51
i32 1, label %54
i32 0, label %58
]
45: ; preds = %38
%46 = load i8*, i8** %4
%47 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %46)
br label %62
48: ; preds = %38
%49 = load i8*, i8** %4
%50 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %49)
br label %51
51: ; preds = %38, %48
%52 = load i8*, i8** %4
%53 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @perror_with_name to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %52)
br label %62
54: ; preds = %38
%55 = load i8*, i8** %5
%56 = load i8*, i8** %4
%57 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %55, i8* %56)
br label %62
58: ; preds = %38
store i32 0, i32* %6
br label %62
59: ; preds = %38
%60 = load i8*, i8** %2
%61 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %59, %58, %54, %51, %45
%63 = load i8*, i8** %4
%64 = load i8*, i8** %5
%65 = load i32, i32* %6
ret i32 %65
}

LLVM IR (-O2):
@.str = [35 x i8] c"touch: Archive `%s' does not exist\00"
@.str.1 = [35 x i8] c"touch: `%s' is not a valid archive\00"
@.str.2 = [8 x i8] c"touch: \00"
@.str.3 = [42 x i8] c"touch: Member `%s' does not exist in `%s'\00"
@.str.4 = [52 x i8] c"touch: Bad return code from ar_member_touch on `%s'\00"
define i32 @ar_touch(i8* %0) {
%2 = tail call i8* @index(i8* %0, i32 40)
%3 = ptrtoint i8* %2 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = tail call i32 (i8*, i64, ...) bitcast (i32 (...)* @savestring to i32 (i8*, i64, ...)*)(i8* %0, i64 %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%10 = trunc i64 %9 to i32
%11 = add i32 %10, -2
%12 = icmp slt i32 %11, 15
%13 = select i1 %12, i32 %11, i32 15
%14 = getelementptr inbounds i8, i8* %2, i64 1
%15 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @savestring to i32 (i8*, i32, ...)*)(i8* %14, i32 %13)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i8*
%18 = tail call i8* @rindex(i8* %17, i32 41)
%19 = icmp eq i8* %18, null
br i1 %19, label %21, label %20
20: ; preds = %1
store i8 0, i8* %18
br label %21
21: ; preds = %20, %1
%22 = tail call i32 (i8*, ...) bitcast (i32 (...)* @enter_file to i32 (i8*, ...)*)(i8* %8)
%23 = tail call i32 (i32, ...) bitcast (i32 (...)* @f_mtime to i32 (i32, ...)*)(i32 %22)
%24 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @ar_member_touch to i32 (i8*, i8*, ...)*)(i8* %8, i8* %17)
switch i32 %24, label %33 [
i32 -1, label %25
i32 -2, label %27
i32 -3, label %29
i32 1, label %31
i32 0, label %35
]
25: ; preds = %21
%26 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %35
27: ; preds = %21
%28 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %29
29: ; preds = %21, %27
%30 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @perror_with_name to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %35
31: ; preds = %21
%32 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %17, i8* %8)
br label %35
33: ; preds = %21
%34 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %35
35: ; preds = %21, %33, %31, %29, %25
%36 = phi i32 [ 1, %33 ], [ 1, %31 ], [ 1, %29 ], [ 1, %25 ], [ %24, %21 ]
tail call void @free(i8* %8)
tail call void @free(i8* %17)
ret i32 %36
}