#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 screen_shot(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int shot(int argc, char *argv[]) {
  char path[256] = "/mnt/sdcard"
                   "/shot.bmp";
  if (argc >= 2) {
    strcpy(path, argv[1]);
  }
  return screen_shot(path);
}


x86 assembly (clang, -O0):
<shot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x100,%edx
call   1040 <memcpy@plt>
cmpl   $0x2,-0x4(%rbp)
jl     1178 <shot+0x48>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x110(%rbp),%rdi
call   1050 <screen_shot@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shot>:
push   %rbp
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xebb(%rip),%rsi
mov    %rsp,%rdi
mov    $0x100,%edx
call   1040 <memcpy@plt>
cmp    $0x2,%ebp
jl     1163 <shot+0x33>
mov    0x8(%rbx),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    %rsp,%rdi
call   1050 <screen_shot@plt>
add    $0x108,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.shot.path = [256 x i8] c"/mnt/sdcard/shot.bmp\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @shot(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [256 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = bitcast [256 x i8]* %5 to i8*
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 2
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strcpy(i8* %10, i8* %13)
br label %15
15: ; preds = %9, %2
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%17 = call i32 @screen_shot(i8* %16)
ret i32 %17
}

LLVM IR (-O2):
@__const.shot.path = [256 x i8] c"/mnt/sdcard/shot.bmp\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @shot(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strcpy(i8* %4, i8* %8)
br label %10
10: ; preds = %6, %2
%11 = call i32 @screen_shot(i8* %4)
ret i32 %11
}