#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*/ paramses;
typedef int /*<<< orphan*/ fakeargv;

/* Variables and functions */
int /*<<< orphan*/ getopt_dump();
int /*<<< orphan*/ printargs(int, char **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ process(int, char **, char *);
int /*<<< orphan*/ reset();
int main(int argc, char *argv[]) {
  char *fakeargv[] = {"fake", "-i", "other", "-v", "-f", "pizza", "-s"};
  int fakeargc = sizeof(fakeargv) / sizeof(char *);
  printf("Fake arguments\n");
  printargs(fakeargc, fakeargv);
  printf("Real arguments\n");
  printargs(argc, argv);
  char *paramses[] = {"f", "fx", "svi:ho:"};
  int num_paramses = sizeof(paramses) / sizeof(char *);
  getopt_dump();
  for (int i = 0; i < num_paramses; i++) {
    char *params = paramses[i];
    reset();
    printf("\nProcessing original arguments with only %s\n", params);
    process(argc, argv, params);
    reset();
    printf("\nProcessing fake arguments with only %s\n", params);
    process(fakeargc, fakeargv, params);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2c3c(%rip),%rsi
mov    $0x38,%edx
call   1070 <memcpy@plt>
movl   $0x7,-0x54(%rbp)
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x54(%rbp),%edi
lea    -0x50(%rbp),%rsi
call   1040 <printargs@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <printargs@plt>
mov    0x2c30(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x2c2d(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0x2c2a(%rip),%rax
mov    %rax,-0x60(%rbp)
movl   $0x3,-0x74(%rbp)
mov    $0x0,%al
call   1030 <getopt_dump@plt>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    1278 <main+0x118>
movslq -0x78(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
mov    %rax,-0x80(%rbp)
mov    $0x0,%al
call   1080 <reset@plt>
mov    -0x80(%rbp),%rsi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x80(%rbp),%rdx
call   1060 <process@plt>
mov    $0x0,%al
call   1080 <reset@plt>
mov    -0x80(%rbp),%rsi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x54(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x80(%rbp),%rdx
call   1060 <process@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11ff <main+0x9f>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r13
mov    %edi,%ebp
mov    0x2c96(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0x2c7a(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2c5e(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2c42(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%r14
mov    $0x7,%edi
mov    %r14,%rsi
call   1050 <printargs@plt>
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
mov    %r13,%rsi
call   1050 <printargs@plt>
xor    %eax,%eax
call   1030 <getopt_dump@plt>
xor    %eax,%eax
call   1080 <reset@plt>
lea    0xe3f(%rip),%r15
lea    0xe22(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1070 <process@plt>
xor    %eax,%eax
call   1080 <reset@plt>
lea    0xe3d(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x7,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1070 <process@plt>
xor    %eax,%eax
call   1080 <reset@plt>
lea    0xdda(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1070 <process@plt>
xor    %eax,%eax
call   1080 <reset@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x7,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1070 <process@plt>
xor    %eax,%eax
call   1080 <reset@plt>
lea    0xd91(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1070 <process@plt>
xor    %eax,%eax
call   1080 <reset@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x7,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1070 <process@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fake\00"
@.str.1 = [3 x i8] c"-i\00"
@.str.2 = [6 x i8] c"other\00"
@.str.3 = [3 x i8] c"-v\00"
@.str.4 = [3 x i8] c"-f\00"
@.str.5 = [6 x i8] c"pizza\00"
@.str.6 = [3 x i8] c"-s\00"
@__const.main.fakeargv = [7 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [16 x i8] c"Fake arguments\0A\00"
@.str.8 = [16 x i8] c"Real arguments\0A\00"
@.str.9 = [2 x i8] c"f\00"
@.str.10 = [3 x i8] c"fx\00"
@.str.11 = [8 x i8] c"svi:ho:\00"
@__const.main.paramses = [3 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [45 x i8] c"\0AProcessing original arguments with only %s\0A\00"
@.str.13 = [41 x i8] c"\0AProcessing fake arguments with only %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [7 x i8*]
%7 = alloca i32
%8 = alloca [3 x i8*]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [7 x i8*]* %6 to i8*
store i32 7, i32* %7
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%14 = load i32, i32* %7
%15 = getelementptr inbounds [7 x i8*], [7 x i8*]* %6, i64 0, i64 0
%16 = call i32 @printargs(i32 %14, i8** %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = call i32 @printargs(i32 %18, i8** %19)
%21 = bitcast [3 x i8*]* %8 to i8*
store i32 3, i32* %9
%22 = call i32 (...) @getopt_dump()
store i32 0, i32* %10
br label %23
23: ; preds = %46, %2
%24 = load i32, i32* %10
%25 = load i32, i32* %9
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %49
27: ; preds = %23
%28 = load i32, i32* %10
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 %29
%31 = load i8*, i8** %30
store i8* %31, i8** %11
%32 = call i32 (...) @reset()
%33 = load i8*, i8** %11
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i8* %33)
%35 = load i32, i32* %4
%36 = load i8**, i8*** %5
%37 = load i8*, i8** %11
%38 = call i32 @process(i32 %35, i8** %36, i8* %37)
%39 = call i32 (...) @reset()
%40 = load i8*, i8** %11
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0), i8* %40)
%42 = load i32, i32* %7
%43 = getelementptr inbounds [7 x i8*], [7 x i8*]* %6, i64 0, i64 0
%44 = load i8*, i8** %11
%45 = call i32 @process(i32 %42, i8** %43, i8* %44)
br label %46
46: ; preds = %27
%47 = load i32, i32* %10
%48 = add nsw i32 %47, 1
store i32 %48, i32* %10
br label %23
49: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"fake\00"
@.str.1 = [3 x i8] c"-i\00"
@.str.2 = [6 x i8] c"other\00"
@.str.3 = [3 x i8] c"-v\00"
@.str.4 = [3 x i8] c"-f\00"
@.str.5 = [6 x i8] c"pizza\00"
@.str.6 = [3 x i8] c"-s\00"
@__const.main.fakeargv = [7 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0)]
@.str.9 = [2 x i8] c"f\00"
@.str.10 = [3 x i8] c"fx\00"
@.str.11 = [8 x i8] c"svi:ho:\00"
@.str.12 = [45 x i8] c"\0AProcessing original arguments with only %s\0A\00"
@.str.13 = [41 x i8] c"\0AProcessing fake arguments with only %s\0A\00"
@str = [15 x i8] c"Fake arguments\00"
@str.14 = [15 x i8] c"Real arguments\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [7 x i8*]
%4 = bitcast [7 x i8*]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 0
%7 = call i32 @printargs(i32 7, i8** %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
%9 = call i32 @printargs(i32 %0, i8** %1)
%10 = call i32 (...) @getopt_dump()
%11 = call i32 (...) @reset()
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%13 = call i32 @process(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 (...) @reset()
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%16 = call i32 @process(i32 7, i8** %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%17 = call i32 (...) @reset()
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%19 = call i32 @process(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%20 = call i32 (...) @reset()
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%22 = call i32 @process(i32 7, i8** %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%23 = call i32 (...) @reset()
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%25 = call i32 @process(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%26 = call i32 (...) @reset()
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%28 = call i32 @process(i32 7, i8** %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}