#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*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ test1(char *, char *);
int /*<<< orphan*/ test2(char *, char *);
int /*<<< orphan*/ test3(char *, char *);
int /*<<< orphan*/ test4(char *, char *);
int /*<<< orphan*/ test5(char *, char *);
int /*<<< orphan*/ test6(char *, char *);
int /*<<< orphan*/ test7(char *, char *);
int main(int argc, char **argv) {
  char *array0 = (char *)malloc(11);
  char *array = array0 + 8;
  char *endptr = NULL;
  array[0] = '1';
  array[1] = '2';
  array[2] = '3';
  if (argc != 2)
    return 1;
  if (!strcmp(argv[1], "test1"))
    test1(array, endptr);
  if (!strcmp(argv[1], "test2"))
    test2(array, endptr);
  if (!strcmp(argv[1], "test3"))
    test3(array0, endptr);
  if (!strcmp(argv[1], "test4"))
    test4(array, endptr);
  if (!strcmp(argv[1], "test5"))
    test5(array, endptr);
  if (!strcmp(argv[1], "test6"))
    test6(array, endptr);
  if (!strcmp(argv[1], "test7"))
    test7(array, endptr);
  free(array0);
  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)
mov    $0xb,%edi
call   1090 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x31,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x32,0x1(%rax)
mov    -0x20(%rbp),%rax
movb   $0x33,0x2(%rax)
cmpl   $0x2,-0x8(%rbp)
je     1205 <main+0x65>
movl   $0x1,-0x4(%rbp)
jmp    133b <main+0x19b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdec(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    122f <main+0x8f>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <test1@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc8(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1259 <main+0xb9>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10c0 <test2@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xda4(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1283 <main+0xe3>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <test3@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd80(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12ad <main+0x10d>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <test4@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd5c(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12d7 <main+0x137>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <test5@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd38(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1301 <main+0x161>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10a0 <test6@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd14(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    132b <main+0x18b>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <test7@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%ebx
mov    $0xb,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
movw   $0x3231,0x8(%rax)
movb   $0x33,0xa(%rax)
mov    $0x1,%eax
cmp    $0x2,%ebx
jne    12c8 <main+0x128>
lea    0x8(%r12),%r14
mov    0x8(%r15),%rbx
lea    0xe1e(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    11fc <main+0x5c>
mov    %r14,%rdi
xor    %esi,%esi
call   1070 <test1@plt>
mov    0x8(%r15),%rbx
lea    0xe03(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    121d <main+0x7d>
mov    %r14,%rdi
xor    %esi,%esi
call   10c0 <test2@plt>
mov    0x8(%r15),%rbx
lea    0xde8(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    123e <main+0x9e>
mov    %r12,%rdi
xor    %esi,%esi
call   1060 <test3@plt>
mov    0x8(%r15),%rbx
lea    0xdcd(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    125f <main+0xbf>
mov    %r14,%rdi
xor    %esi,%esi
call   10b0 <test4@plt>
mov    0x8(%r15),%rbx
lea    0xdb2(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    1280 <main+0xe0>
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <test5@plt>
mov    0x8(%r15),%rbx
lea    0xd97(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    12a1 <main+0x101>
mov    %r14,%rdi
xor    %esi,%esi
call   10a0 <test6@plt>
mov    0x8(%r15),%rbx
lea    0xd7c(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    12be <main+0x11e>
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <test7@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"test1\00"
@.str.1 = [6 x i8] c"test2\00"
@.str.2 = [6 x i8] c"test3\00"
@.str.3 = [6 x i8] c"test4\00"
@.str.4 = [6 x i8] c"test5\00"
@.str.5 = [6 x i8] c"test6\00"
@.str.6 = [6 x i8] c"test7\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i64 @malloc(i32 11)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = getelementptr inbounds i8, i8* %11, i64 8
store i8* %12, i8** %7
store i8* null, i8** %8
%13 = load i8*, i8** %7
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 49, i8* %14
%15 = load i8*, i8** %7
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 50, i8* %16
%17 = load i8*, i8** %7
%18 = getelementptr inbounds i8, i8* %17, i64 2
store i8 51, i8* %18
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 2
br i1 %20, label %21, label %22
21: ; preds = %2
store i32 1, i32* %3
br label %95
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %22
%29 = load i8*, i8** %7
%30 = load i8*, i8** %8
%31 = call i32 @test1(i8* %29, i8* %30)
br label %32
32: ; preds = %28, %22
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @strcmp(i8* %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp ne i32 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %32
%39 = load i8*, i8** %7
%40 = load i8*, i8** %8
%41 = call i32 @test2(i8* %39, i8* %40)
br label %42
42: ; preds = %38, %32
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @strcmp(i8* %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%47 = icmp ne i32 %46, 0
br i1 %47, label %52, label %48
48: ; preds = %42
%49 = load i8*, i8** %6
%50 = load i8*, i8** %8
%51 = call i32 @test3(i8* %49, i8* %50)
br label %52
52: ; preds = %48, %42
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = call i32 @strcmp(i8* %55, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%57 = icmp ne i32 %56, 0
br i1 %57, label %62, label %58
58: ; preds = %52
%59 = load i8*, i8** %7
%60 = load i8*, i8** %8
%61 = call i32 @test4(i8* %59, i8* %60)
br label %62
62: ; preds = %58, %52
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 1
%65 = load i8*, i8** %64
%66 = call i32 @strcmp(i8* %65, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%67 = icmp ne i32 %66, 0
br i1 %67, label %72, label %68
68: ; preds = %62
%69 = load i8*, i8** %7
%70 = load i8*, i8** %8
%71 = call i32 @test5(i8* %69, i8* %70)
br label %72
72: ; preds = %68, %62
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
%76 = call i32 @strcmp(i8* %75, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%77 = icmp ne i32 %76, 0
br i1 %77, label %82, label %78
78: ; preds = %72
%79 = load i8*, i8** %7
%80 = load i8*, i8** %8
%81 = call i32 @test6(i8* %79, i8* %80)
br label %82
82: ; preds = %78, %72
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 1
%85 = load i8*, i8** %84
%86 = call i32 @strcmp(i8* %85, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%87 = icmp ne i32 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %82
%89 = load i8*, i8** %7
%90 = load i8*, i8** %8
%91 = call i32 @test7(i8* %89, i8* %90)
br label %92
92: ; preds = %88, %82
%93 = load i8*, i8** %6
%94 = call i32 @free(i8* %93)
store i32 0, i32* %3
br label %95
95: ; preds = %92, %21
%96 = load i32, i32* %3
ret i32 %96
}

LLVM IR (-O2):
@.str = [6 x i8] c"test1\00"
@.str.1 = [6 x i8] c"test2\00"
@.str.2 = [6 x i8] c"test3\00"
@.str.3 = [6 x i8] c"test4\00"
@.str.4 = [6 x i8] c"test5\00"
@.str.5 = [6 x i8] c"test6\00"
@.str.6 = [6 x i8] c"test7\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @malloc(i32 11)
%4 = inttoptr i64 %3 to i8*
%5 = getelementptr inbounds i8, i8* %4, i64 8
store i8 49, i8* %5
%6 = getelementptr inbounds i8, i8* %4, i64 9
store i8 50, i8* %6
%7 = getelementptr inbounds i8, i8* %4, i64 10
store i8 51, i8* %7
%8 = icmp eq i32 %0, 2
br i1 %8, label %9, label %60
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = tail call i32 @test1(i8* %5, i8* null)
%16 = load i8*, i8** %10
br label %17
17: ; preds = %14, %9
%18 = phi i8* [ %16, %14 ], [ %11, %9 ]
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = tail call i32 @test2(i8* %5, i8* null)
%23 = load i8*, i8** %10
br label %24
24: ; preds = %21, %17
%25 = phi i8* [ %23, %21 ], [ %18, %17 ]
%26 = tail call i32 @strcmp(i8* dereferenceable(1) %25, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = tail call i32 @test3(i8* %4, i8* null)
%30 = load i8*, i8** %10
br label %31
31: ; preds = %28, %24
%32 = phi i8* [ %30, %28 ], [ %25, %24 ]
%33 = tail call i32 @strcmp(i8* dereferenceable(1) %32, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = tail call i32 @test4(i8* %5, i8* null)
%37 = load i8*, i8** %10
br label %38
38: ; preds = %35, %31
%39 = phi i8* [ %37, %35 ], [ %32, %31 ]
%40 = tail call i32 @strcmp(i8* dereferenceable(1) %39, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = tail call i32 @test5(i8* %5, i8* null)
%44 = load i8*, i8** %10
br label %45
45: ; preds = %42, %38
%46 = phi i8* [ %44, %42 ], [ %39, %38 ]
%47 = tail call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = tail call i32 @test6(i8* %5, i8* null)
%51 = load i8*, i8** %10
br label %52
52: ; preds = %49, %45
%53 = phi i8* [ %51, %49 ], [ %46, %45 ]
%54 = tail call i32 @strcmp(i8* dereferenceable(1) %53, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = tail call i32 @test7(i8* %5, i8* null)
br label %58
58: ; preds = %56, %52
%59 = tail call i32 @free(i8* %4)
br label %60
60: ; preds = %2, %58
%61 = phi i32 [ 0, %58 ], [ 1, %2 ]
ret i32 %61
}