int dotcpreset(argc, argv)
int argc;
char *argv[];
{
  register struct tcb *tcb;
  extern char notval[];
  tcb = (struct tcb *)htol(argv[1]);
  if (!tcpval(tcb)) {
    printf(notval);
    return 1;
  }
  close_self(tcb, 1);
  return 0;
}


x86 assembly (clang, -O0):
<dotcpreset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   1040 <htol@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <tcpval@plt>
cmp    $0x0,%eax
jne    1192 <dotcpreset+0x52>
mov    0x2e61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a9 <dotcpreset+0x69>
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1060 <close_self@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotcpreset>:
push   %rbp
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <htol@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <tcpval@plt>
test   %eax,%eax
je     1172 <dotcpreset+0x32>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <close_self@plt>
jmp    1185 <dotcpreset+0x45>
mov    0x2e67(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tcb = type opaque
@notval = external global [0 x i8]
define i32 @dotcpreset(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.tcb*
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @htol to i32 (i8*, ...)*)(i8* %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to %struct.tcb*
store %struct.tcb* %12, %struct.tcb** %6
%13 = load %struct.tcb*, %struct.tcb** %6
%14 = call i32 (%struct.tcb*, ...) bitcast (i32 (...)* @tcpval to i32 (%struct.tcb*, ...)*)(%struct.tcb* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @notval, i64 0, i64 0))
store i32 1, i32* %3
br label %21
18: ; preds = %2
%19 = load %struct.tcb*, %struct.tcb** %6
%20 = call i32 (%struct.tcb*, i32, ...) bitcast (i32 (...)* @close_self to i32 (%struct.tcb*, i32, ...)*)(%struct.tcb* %19, i32 1)
store i32 0, i32* %3
br label %21
21: ; preds = %18, %16
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
%struct.tcb = type opaque
@notval = external global [0 x i8]
define i32 @dotcpreset(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @htol to i32 (i8*, ...)*)(i8* %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to %struct.tcb*
%8 = tail call i32 (%struct.tcb*, ...) bitcast (i32 (...)* @tcpval to i32 (%struct.tcb*, ...)*)(%struct.tcb* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([0 x i8], [0 x i8]* @notval, i64 0, i64 0))
br label %14
12: ; preds = %2
%13 = tail call i32 (%struct.tcb*, i32, ...) bitcast (i32 (...)* @close_self to i32 (%struct.tcb*, i32, ...)*)(%struct.tcb* %7, i32 1)
br label %14
14: ; preds = %12, %10
%15 = phi i32 [ 0, %12 ], [ 1, %10 ]
ret i32 %15
}