#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 *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *);
int system(char *);
void copy_tags_from_source(const char *source, const char *dest) {
  char exif_cmd[1000];
  printf("%-16s: copying EXIF from %s\n", dest, source);
  snprintf(exif_cmd, sizeof(exif_cmd),
           "exiftool -tagsFromFile \"%s\" -all:all \"-xmp:subject=Dual-ISO\" "
           "\"-UniqueCameraModel<Model\" \"%s\" -overwrite_original -q",
           source, dest);
  int r = system(exif_cmd);
  if (r != 0) {
    printf("**WARNING** exiftool couldn't update DNG tag data\n");
  }
}


x86 assembly (clang, -O0):
<copy_tags_from_source>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    $0x3e8,%esi
lea    0xea9(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x400(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x404(%rbp)
cmpl   $0x0,-0x404(%rbp)
je     11a6 <copy_tags_from_source+0x76>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_tags_from_source>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xea7(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb3(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x3e8,%esi
mov    %rbx,%rcx
mov    %r14,%r8
call   1060 <snprintf@plt>
mov    %r15,%rdi
call   1040 <system@plt>
test   %eax,%eax
je     1198 <copy_tags_from_source+0x58>
lea    0xefe(%rip),%rdi
call   1030 <puts@plt>
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"%-16s: copying EXIF from %s\0A\00"
@.str.1 = [116 x i8] c"exiftool -tagsFromFile \22%s\22 -all:all \22-xmp:subject=Dual-ISO\22 \22-UniqueCameraModel<Model\22 \22%s\22 -overwrite_original -q\00"
@.str.2 = [51 x i8] c"**WARNING** exiftool couldn't update DNG tag data\0A\00"
define void @copy_tags_from_source(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1000 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i32 @snprintf(i8* %10, i32 1000, i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %12)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%15 = call i32 @system(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %2
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"%-16s: copying EXIF from %s\0A\00"
@.str.1 = [116 x i8] c"exiftool -tagsFromFile \22%s\22 -all:all \22-xmp:subject=Dual-ISO\22 \22-UniqueCameraModel<Model\22 \22%s\22 -overwrite_original -q\00"
@str = [50 x i8] c"**WARNING** exiftool couldn't update DNG tag data\00"
define void @copy_tags_from_source(i8* %0, i8* %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
%6 = call i32 @snprintf(i8* %4, i32 1000, i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
%7 = call i32 @system(i8* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
ret void
}