#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 *argv2Ints(int, char **);
int /*<<< orphan*/ atoi(char *);
int minPatches(int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  if (argc < 2) {
    return 0;
  }
  int *list = argv2Ints(argc - 2, argv + 2);
  printf("Patch: %d\n", minPatches(list, argc - 2, atoi(argv[1])));
  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   $0x2,-0x8(%rbp)
jge    116c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    11c4 <main+0x84>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1050 <argv2Ints@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
call   1040 <minPatches@plt>
mov    %eax,%esi
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jl     1188 <main+0x48>
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
add    $0xfffffffe,%ebx
add    $0x10,%rsi
mov    %ebx,%edi
call   1050 <argv2Ints@plt>
mov    %rax,%r15
mov    0x8(%r14),%rdi
call   1060 <atoi@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <minPatches@plt>
lea    0xe84(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
pop    %rbx
pop    %r14
pop    %r15
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Patch: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %25
10: ; preds = %2
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = call i32* @argv2Ints(i32 %12, i8** %14)
store i32* %15, i32** %6
%16 = load i32*, i32** %6
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
%23 = call i32 @minPatches(i32* %16, i32 %18, i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %23)
store i32 0, i32* %3
br label %25
25: ; preds = %10, %9
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [11 x i8] c"Patch: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = add nsw i32 %0, -2
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = tail call i32* @argv2Ints(i32 %5, i8** %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = tail call i32 @minPatches(i32* %7, i32 %5, i32 %10)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %2, %4
ret i32 0
}