#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 */
struct stat {
  int dummy;
};
struct FTW {
  int dummy;
};

/* Variables and functions */
int FTW_F;
int attachuu2bin(char const *);
char *basename(char const *);
int /*<<< orphan*/ printf(char *, int, char const *);
int dotran(const char *file, const struct stat *sb, int flag,
           struct FTW *unused) {
  int ret;
  char *ptr;
  if (FTW_F != flag)
    return 0;
  ptr = basename(file);
  if (*ptr == '.')
    return 0;
  ret = attachuu2bin(file);
  if (ret && ret != -5)
    printf("%d %s\n", ret, file);
  return 0;
}


x86 assembly (clang, -O0):
<dotran>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
je     1165 <dotran+0x35>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <dotran+0x98>
mov    -0x10(%rbp),%rdi
call   1050 <basename@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    118e <dotran+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    11c8 <dotran+0x98>
mov    -0x10(%rbp),%rdi
call   1030 <attachuu2bin@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     11c1 <dotran+0x91>
cmpl   $0xfffffffb,-0x2c(%rbp)
je     11c1 <dotran+0x91>
mov    -0x2c(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotran>:
push   %rbx
mov    0x2eb0(%rip),%rax
cmp    %edx,(%rax)
jne    116b <dotran+0x3b>
mov    %rdi,%rbx
call   1050 <basename@plt>
cmpb   $0x2e,(%rax)
je     116b <dotran+0x3b>
mov    %rbx,%rdi
call   1030 <attachuu2bin@plt>
cmp    $0xfffffffb,%eax
je     116b <dotran+0x3b>
test   %eax,%eax
je     116b <dotran+0x3b>
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.FTW = type { i32 }
@FTW_F = global i32 0
@.str = [7 x i8] c"%d %s\0A\00"
define i32 @dotran(i8* %0, %struct.stat* %1, i32 %2, %struct.FTW* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.stat*
%8 = alloca i32
%9 = alloca %struct.FTW*
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %6
store %struct.stat* %1, %struct.stat** %7
store i32 %2, i32* %8
store %struct.FTW* %3, %struct.FTW** %9
%12 = load i32, i32* @FTW_F
%13 = load i32, i32* %8
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %4
store i32 0, i32* %5
br label %37
16: ; preds = %4
%17 = load i8*, i8** %6
%18 = call i8* @basename(i8* %17)
store i8* %18, i8** %11
%19 = load i8*, i8** %11
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 46
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 0, i32* %5
br label %37
24: ; preds = %16
%25 = load i8*, i8** %6
%26 = call i32 @attachuu2bin(i8* %25)
store i32 %26, i32* %10
%27 = load i32, i32* %10
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %24
%30 = load i32, i32* %10
%31 = icmp ne i32 %30, -5
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* %10
%34 = load i8*, i8** %6
%35 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %33, i8* %34)
br label %36
36: ; preds = %32, %29, %24
store i32 0, i32* %5
br label %37
37: ; preds = %36, %23, %15
%38 = load i32, i32* %5
ret i32 %38
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.FTW = type { i32 }
@FTW_F = global i32 0
@.str = [7 x i8] c"%d %s\0A\00"
define i32 @dotran(i8* %0, %struct.stat* nocapture readnone %1, i32 %2, %struct.FTW* nocapture readnone %3) {
%5 = load i32, i32* @FTW_F
%6 = icmp eq i32 %5, %2
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = tail call i8* @basename(i8* %0)
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 46
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = tail call i32 @attachuu2bin(i8* %0)
switch i32 %12, label %13 [
i32 -5, label %15
i32 0, label %15
]
13: ; preds = %11
%14 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %0)
br label %15
15: ; preds = %13, %11, %11, %7, %4
ret i32 0
}