#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 /*<<< orphan*/ err_quit(char *);
int /*<<< orphan*/ printf(char *, char *);
char *tempnam(char *, char *);
int main(int argc, char **argv) {
  if (argc != 3) {
    err_quit("usage: a.out dir prefix");
  }
  printf("%s\n", tempnam(*(*++argv) != ' ' ? *argv : NULL,
                         *(*++argv) != ' ' ? *argv : NULL));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     115c <main+0x2c>
lea    0xea9(%rip),%rdi
call   1040 <err_quit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     118b <main+0x5b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1196 <main+0x66>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1196 <main+0x66>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     11cd <main+0x9d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    11d8 <main+0xa8>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    11d8 <main+0xa8>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <tempnam@plt>
mov    %rax,%rsi
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1145 <main+0x15>
lea    0xec0(%rip),%rdi
call   1040 <err_quit@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
xor    %eax,%eax
cmpb   $0x20,(%rdi)
cmove  %rax,%rdi
cmpb   $0x20,(%rsi)
cmove  %rax,%rsi
call   1050 <tempnam@plt>
lea    0xeaf(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"usage: a.out dir prefix\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @err_quit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i32 1
store i8** %12, i8*** %5
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 32
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
br label %21
20: ; preds = %10
br label %21
21: ; preds = %20, %17
%22 = phi i8* [ %19, %17 ], [ null, %20 ]
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i32 1
store i8** %24, i8*** %5
%25 = load i8*, i8** %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 32
br i1 %28, label %29, label %32
29: ; preds = %21
%30 = load i8**, i8*** %5
%31 = load i8*, i8** %30
br label %33
32: ; preds = %21
br label %33
33: ; preds = %32, %29
%34 = phi i8* [ %31, %29 ], [ null, %32 ]
%35 = call i8* @tempnam(i8* %22, i8* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"usage: a.out dir prefix\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @err_quit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 32
%11 = select i1 %10, i8* null, i8* %8
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 32
%16 = select i1 %15, i8* null, i8* %13
%17 = tail call i8* @tempnam(i8* %11, i8* %16)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
ret i32 0
}