#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void check_argc(int argc) {
  if (argc != 7) {
    printf("Not right number of arguments\n");
    printf("Got %d, expected 6 arguments\n", argc);
    printf("Usage\n");
    printf("chroot_wrapper OPTIONS PATH COMMAND INPUT OUTPUT\n\n");
    printf(
        "OPTIONS - 0 if not using /proc filesystem, 1 if you are using it\n");
    printf("PATH - the path for the new chroot\n");
    printf("COMMAND - the command to execute within the new chroot");
    printf(" (local to the new chroot)\n");
    printf("INPUT - the inputfile (stdin will be redirected from here)\n");
    printf("OUTPUT - the output file (stdout will be redirected here)\n");
    printf("LOG ID - the unique identifier for the log file\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<check_argc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
je     11d9 <check_argc+0xb9>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfdc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_argc>:
cmp    $0x7,%edi
jne    1136 <check_argc+0x6>
ret
push   %rbx
mov    %edi,%ebx
lea    0xf15(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xf37(%rip),%rdi
call   1030 <puts@plt>
lea    0xf6c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf75(%rip),%rdi
call   1030 <puts@plt>
lea    0xf84(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xfe1(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Not right number of arguments\0A\00"
@.str.1 = [30 x i8] c"Got %d, expected 6 arguments\0A\00"
@.str.2 = [7 x i8] c"Usage\0A\00"
@.str.3 = [51 x i8] c"chroot_wrapper OPTIONS PATH COMMAND INPUT OUTPUT\0A\0A\00"
@.str.4 = [66 x i8] c"OPTIONS - 0 if not using /proc filesystem, 1 if you are using it\0A\00"
@.str.5 = [36 x i8] c"PATH - the path for the new chroot\0A\00"
@.str.6 = [55 x i8] c"COMMAND - the command to execute within the new chroot\00"
@.str.7 = [28 x i8] c" (local to the new chroot)\0A\00"
@.str.8 = [60 x i8] c"INPUT - the inputfile (stdin will be redirected from here)\0A\00"
@.str.9 = [59 x i8] c"OUTPUT - the output file (stdout will be redirected here)\0A\00"
@.str.10 = [49 x i8] c"LOG ID - the unique identifier for the log file\0A\00"
define void @check_argc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 7
br i1 %4, label %5, label %19
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.10, i64 0, i64 0))
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"Got %d, expected 6 arguments\0A\00"
@.str.6 = [55 x i8] c"COMMAND - the command to execute within the new chroot\00"
@str = [30 x i8] c"Not right number of arguments\00"
@str.11 = [6 x i8] c"Usage\00"
@str.12 = [50 x i8] c"chroot_wrapper OPTIONS PATH COMMAND INPUT OUTPUT\0A\00"
@str.13 = [65 x i8] c"OPTIONS - 0 if not using /proc filesystem, 1 if you are using it\00"
@str.14 = [35 x i8] c"PATH - the path for the new chroot\00"
@str.15 = [27 x i8] c" (local to the new chroot)\00"
@str.16 = [59 x i8] c"INPUT - the inputfile (stdin will be redirected from here)\00"
@str.17 = [58 x i8] c"OUTPUT - the output file (stdout will be redirected here)\00"
@str.18 = [48 x i8] c"LOG ID - the unique identifier for the log file\00"
define void @check_argc(i32 %0) {
%2 = icmp eq i32 %0, 7
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.13, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.14, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.15, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.16, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.17, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.18, i64 0, i64 0))
%15 = tail call i32 @exit(i32 0)
unreachable
16: ; preds = %1
ret void
}