#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 *, int);
int system(char *);
void set_white_level(const char *file, int level) {
  char exif_cmd[1000];
  snprintf(exif_cmd, sizeof(exif_cmd),
           "exiftool \"%s\" -WhiteLevel=%d -overwrite_original -q", file,
           level);
  int r = system(exif_cmd);
  if (r != 0) {
    printf("**WARNING** exiftool couldn't update white level\n");
  }
}


x86 assembly (clang, -O0):
<set_white_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
mov    $0x3e8,%esi
lea    0xea3(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x400(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x404(%rbp)
cmpl   $0x0,-0x404(%rbp)
je     118d <set_white_level+0x5d>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_white_level>:
push   %rbx
sub    $0x3f0,%rsp
mov    %esi,%r8d
mov    %rdi,%rcx
lea    0xebb(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
test   %eax,%eax
je     116d <set_white_level+0x3d>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"exiftool \22%s\22 -WhiteLevel=%d -overwrite_original -q\00"
@.str.1 = [50 x i8] c"**WARNING** exiftool couldn't update white level\0A\00"
define void @set_white_level(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [1000 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @snprintf(i8* %7, i32 1000, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%12 = call i32 @system(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"exiftool \22%s\22 -WhiteLevel=%d -overwrite_original -q\00"
@str = [49 x i8] c"**WARNING** exiftool couldn't update white level\00"
define void @set_white_level(i8* %0, i32 %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 1000, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%6 = call i32 @system(i8* %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
ret void
}