#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 */
typedef int /*<<< orphan*/ exif_cmd;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int system(char *);
void dng_backup_metadata(const char *dng_file) {
  printf("%-16s: backing up metadata\n", dng_file);
  char exif_cmd[1000];
  snprintf(exif_cmd, sizeof(exif_cmd),
           "exiftool -j -G -q -w json \"%s\" --EXIF:all --File:all "
           "--Exiftool:all --MakerNotes:all --Composite:all ",
           dng_file);
  int r = system(exif_cmd);
  if (r != 0) {
    printf("%-16s: could not backup metadata\n", dng_file);
  }
}


x86 assembly (clang, -O0):
<dng_backup_metadata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
lea    -0x3f0(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x3e8,%esi
lea    0xeb6(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x3f4(%rbp)
cmpl   $0x0,-0x3f4(%rbp)
je     119a <dng_backup_metadata+0x6a>
mov    -0x8(%rbp),%rsi
lea    0xeed(%rip),%rdi
call   1040 <printf@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dng_backup_metadata>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rdi,%rbx
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xec9(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x3e8,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
test   %eax,%eax
je     1181 <dng_backup_metadata+0x51>
lea    0xf09(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"%-16s: backing up metadata\0A\00"
@.str.1 = [102 x i8] c"exiftool -j -G -q -w json \22%s\22 --EXIF:all --File:all --Exiftool:all --MakerNotes:all --Composite:all \00"
@.str.2 = [34 x i8] c"%-16s: could not backup metadata\0A\00"
define void @dng_backup_metadata(i8* %0) {
%2 = alloca i8*
%3 = alloca [1000 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%8 = load i8*, i8** %2
%9 = call i32 @snprintf(i8* %7, i32 1000, i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%11 = call i32 @system(i8* %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14, %1
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"%-16s: backing up metadata\0A\00"
@.str.1 = [102 x i8] c"exiftool -j -G -q -w json \22%s\22 --EXIF:all --File:all --Exiftool:all --MakerNotes:all --Composite:all \00"
@.str.2 = [34 x i8] c"%-16s: could not backup metadata\0A\00"
define void @dng_backup_metadata(i8* %0) {
%2 = alloca [1000 x i8]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 1000, i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = call i32 @system(i8* %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %8, %1
ret void
}