#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*/ free(void *);
int /*<<< orphan*/ parse_dep_file(void *, char const *);
void *read_file(char const *);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ xprintf(char *, char const *, char const *);
int main(int argc, char *argv[]) {
  const char *depfile, *target, *cmdline;
  void *buf;
  if (argc != 4)
    usage();
  depfile = argv[1];
  target = argv[2];
  cmdline = argv[3];
  xprintf("cmd_%s := %s\n\n", target, cmdline);
  buf = read_file(depfile);
  parse_dep_file(buf, target);
  free(buf);
  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   $0x4,-0x8(%rbp)
je     1177 <main+0x27>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe56(%rip),%rdi
call   1050 <xprintf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <read_file@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <parse_dep_file@plt>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x4,%edi
je     1164 <main+0x14>
xor    %eax,%eax
call   1070 <usage@plt>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%r15
mov    0x18(%rbx),%rdx
lea    0xe89(%rip),%rdi
mov    %r15,%rsi
call   1050 <xprintf@plt>
mov    %r14,%rdi
call   1060 <read_file@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <parse_dep_file@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"cmd_%s := %s\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
%13 = tail call i32 @xprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %12)
%14 = tail call i8* @read_file(i8* %8)
%15 = tail call i32 @parse_dep_file(i8* %14, i8* %10)
%16 = tail call i32 @free(i8* %14)
ret i32 0
}