#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 getopt(int, char **, char *);
char *optarg;
int optind;
int /*<<< orphan*/ printf(char *, char *, int);
int test_getopt7(void) {
  int r;
  char *a1 = "tail";
  char *a2 = "README";
  char *a3 = "foo";
  char *a4 = "-n";
  char *a5 = "10";
  char *t7[] = {a1, a2, a3, a4, a5, NULL};
  int ac = 5;
  optind = 0;
  r = getopt(ac, t7, "n:");
  do {
    if (!(r == 'n')) {
      printf("expression '%s' untrue at %d\n", "r == 'n'", 156);
      return 0;
    }
  } while (0);
  do {
    if (!(optarg == a5)) {
      printf("expression '%s' untrue at %d\n", "optarg == a5", 158);
      return 0;
    }
  } while (0);
  do {
    if (!(optind == 5)) {
      printf("expression '%s' untrue at %d\n", "optind == 5", 159);
      return 0;
    }
  } while (0);
  return 1;
}


x86 assembly (clang, -O0):
<test_getopt7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xecb(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xec7(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb8(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x5,-0x64(%rbp)
mov    0x2e43(%rip),%rax
movl   $0x0,(%rax)
mov    -0x64(%rbp),%edi
lea    -0x60(%rbp),%rsi
lea    0xe65(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x6e,-0x8(%rbp)
je     11e7 <test_getopt7+0xc7>
lea    0xe4f(%rip),%rdi
lea    0xe66(%rip),%rsi
mov    $0x9c,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1273 <test_getopt7+0x153>
jmp    11ec <test_getopt7+0xcc>
jmp    11f1 <test_getopt7+0xd1>
mov    0x2e00(%rip),%rax
mov    (%rax),%rax
cmp    -0x30(%rbp),%rax
je     1229 <test_getopt7+0x109>
lea    0xe0d(%rip),%rdi
lea    0xe2d(%rip),%rsi
mov    $0x9e,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1273 <test_getopt7+0x153>
jmp    122e <test_getopt7+0x10e>
jmp    1233 <test_getopt7+0x113>
mov    0x2da6(%rip),%rax
cmpl   $0x5,(%rax)
je     1267 <test_getopt7+0x147>
lea    0xdcf(%rip),%rdi
lea    0xdfc(%rip),%rsi
mov    $0x9f,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1273 <test_getopt7+0x153>
jmp    126c <test_getopt7+0x14c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_getopt7>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xed2(%rip),%rax
mov    %rax,(%rsp)
lea    0xecc(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xec7(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xebf(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xeb6(%rip),%rbx
mov    %rbx,0x20(%rsp)
movq   $0x0,0x28(%rsp)
mov    0x2e6e(%rip),%r14
movl   $0x0,(%r14)
lea    0xe96(%rip),%rdx
mov    %rsp,%rsi
mov    $0x5,%edi
call   1040 <getopt@plt>
cmp    $0x6e,%eax
jne    11b3 <test_getopt7+0x93>
mov    0x2e5f(%rip),%rax
cmp    %rbx,(%rax)
je     11d5 <test_getopt7+0xb5>
lea    0xe74(%rip),%rdi
lea    0xe94(%rip),%rsi
mov    $0x9e,%edx
jmp    11c6 <test_getopt7+0xa6>
lea    0xe5f(%rip),%rdi
lea    0xe76(%rip),%rsi
mov    $0x9c,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%eax
cmpl   $0x5,(%r14)
je     11cd <test_getopt7+0xad>
lea    0xe32(%rip),%rdi
lea    0xe5f(%rip),%rsi
mov    $0x9f,%edx
jmp    11c6 <test_getopt7+0xa6>

LLVM IR (-O0):
@.str = [5 x i8] c"tail\00"
@.str.1 = [7 x i8] c"README\00"
@.str.2 = [4 x i8] c"foo\00"
@.str.3 = [3 x i8] c"-n\00"
@.str.4 = [3 x i8] c"10\00"
@optind = global i32 0
@.str.5 = [3 x i8] c"n:\00"
@.str.6 = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.7 = [9 x i8] c"r == 'n'\00"
@optarg = global i8* null
@.str.8 = [13 x i8] c"optarg == a5\00"
@.str.9 = [12 x i8] c"optind == 5\00"
define i32 @test_getopt7() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [6 x i8*]
%9 = alloca i32
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %7
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i64 0, i64 0
%11 = load i8*, i8** %3
store i8* %11, i8** %10
%12 = getelementptr inbounds i8*, i8** %10, i64 1
%13 = load i8*, i8** %4
store i8* %13, i8** %12
%14 = getelementptr inbounds i8*, i8** %12, i64 1
%15 = load i8*, i8** %5
store i8* %15, i8** %14
%16 = getelementptr inbounds i8*, i8** %14, i64 1
%17 = load i8*, i8** %6
store i8* %17, i8** %16
%18 = getelementptr inbounds i8*, i8** %16, i64 1
%19 = load i8*, i8** %7
store i8* %19, i8** %18
%20 = getelementptr inbounds i8*, i8** %18, i64 1
store i8* null, i8** %20
store i32 5, i32* %9
store i32 0, i32* @optind
%21 = load i32, i32* %9
%22 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i64 0, i64 0
%23 = call i32 @getopt(i32 %21, i8** %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32 %23, i32* %2
br label %24
24: ; preds = %0
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 110
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 156)
store i32 0, i32* %1
br label %46
29: ; preds = %24
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
%32 = load i8*, i8** @optarg
%33 = load i8*, i8** %7
%34 = icmp eq i8* %32, %33
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 158)
store i32 0, i32* %1
br label %46
37: ; preds = %31
br label %38
38: ; preds = %37
br label %39
39: ; preds = %38
%40 = load i32, i32* @optind
%41 = icmp eq i32 %40, 5
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 159)
store i32 0, i32* %1
br label %46
44: ; preds = %39
br label %45
45: ; preds = %44
store i32 1, i32* %1
br label %46
46: ; preds = %45, %42, %35, %27
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [5 x i8] c"tail\00"
@.str.1 = [7 x i8] c"README\00"
@.str.2 = [4 x i8] c"foo\00"
@.str.3 = [3 x i8] c"-n\00"
@.str.4 = [3 x i8] c"10\00"
@optind = global i32 0
@.str.5 = [3 x i8] c"n:\00"
@.str.6 = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.7 = [9 x i8] c"r == 'n'\00"
@optarg = global i8* null
@.str.8 = [13 x i8] c"optarg == a5\00"
@.str.9 = [12 x i8] c"optind == 5\00"
define i32 @test_getopt7() {
%1 = alloca [6 x i8*]
%2 = bitcast [6 x i8*]* %1 to i8*
%3 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %1, i64 0, i64 5
store i8* null, i8** %8
store i32 0, i32* @optind
%9 = call i32 @getopt(i32 5, i8** %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%10 = icmp eq i32 %9, 110
br i1 %10, label %13, label %11
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 156)
br label %23
13: ; preds = %0
%14 = load i8*, i8** @optarg
%15 = icmp eq i8* %14, getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 158)
br label %23
18: ; preds = %13
%19 = load i32, i32* @optind
%20 = icmp eq i32 %19, 5
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 159)
br label %23
23: ; preds = %18, %21, %16, %11
%24 = phi i32 [ 0, %21 ], [ 0, %16 ], [ 0, %11 ], [ 1, %18 ]
ret i32 %24
}