void cache_expire(int sock, char *host, char *uri, int x, int y, int z) {
  if (sock < 0) {
    return;
  }
  char *url = (char *)malloc(1024);
  sprintf(url, "http://%s%s%i/%i/%i.png", host, uri, z, x, y);
  cache_expire_url(sock, url);
  free(url);
}


x86 assembly (clang, -O0):
<cache_expire>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    116d <cache_expire+0x2d>
jmp    11ba <cache_expire+0x7a>
mov    $0x400,%edi
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%eax
lea    0xe67(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1050 <cache_expire_url@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cache_expire>:
test   %edi,%edi
js     11b6 <cache_expire+0x76>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%ebp
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%r13
mov    %edi,%ebx
mov    $0x400,%edi
mov    %r9d,0x14(%rsp)
call   1040 <malloc@plt>
mov    %rax,%r14
mov    %ebp,(%rsp)
lea    0xe84(%rip),%rsi
mov    %rax,%rdi
mov    %r13,%rdx
mov    %r12,%rcx
mov    0x14(%rsp),%r8d
mov    %r15d,%r9d
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <cache_expire_url@plt>
mov    %r14,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
@.str = [24 x i8] c"http://%s%s%i/%i/%i.png\00"
define void @cache_expire(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
store i32 %0, i32* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %6
br label %30
17: ; preds = %6
%18 = call i8* @malloc(i64 1024)
store i8* %18, i8** %13
%19 = load i8*, i8** %13
%20 = load i8*, i8** %8
%21 = load i8*, i8** %9
%22 = load i32, i32* %12
%23 = load i32, i32* %10
%24 = load i32, i32* %11
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %20, i8* %21, i32 %22, i32 %23, i32 %24)
%26 = load i32, i32* %7
%27 = load i8*, i8** %13
%28 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @cache_expire_url to i32 (i32, i8*, ...)*)(i32 %26, i8* %27)
%29 = load i8*, i8** %13
br label %30
30: ; preds = %17, %16
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"http://%s%s%i/%i/%i.png\00"
define void @cache_expire(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp slt i32 %0, 0
br i1 %7, label %12, label %8
8: ; preds = %6
%9 = tail call dereferenceable_or_null(1024) i8* @malloc(i64 1024)
%10 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i32 %5, i32 %3, i32 %4)
%11 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @cache_expire_url to i32 (i32, i8*, ...)*)(i32 %0, i8* %9)
tail call void @free(i8* %9)
br label %12
12: ; preds = %6, %8
ret void
}