#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*/ printf(char *, ...);
scalar_t__ strcmp(char const *, char const *);
int main(int argc, char *argv[]) {
  const char *primary[] = {"1280x800", "1024x768", "800x600",
                           "640x480",  "640x400",  NULL};
  const char *second[] = {"1366x768", "1280x1024", "1280x960",
                          "1280x720", "1024x768",  "800x600",
                          "640x480",  "720x400",   NULL};
  int i;
  int j;
  printf("primary resolution:\n");
  i = 0;
  while (primary[i]) {
    printf("%s\n", primary[i]);
    i++;
  }
  printf("second resolution: \n");
  i = 0;
  while (second[i]) {
    printf("%s\n", second[i]);
    i++;
  }
  printf("find the best similar resolution: \n");
  i = 0;
  while (primary[i]) {
    j = 0;
    while (second[j]) {
      if (strcmp(primary[i], second[j]) == 0) {
        printf("%s\n", primary[i]);
        goto cleanup;
      }
      j++;
    }
    i++;
  }
cleanup:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
lea    0xe90(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe8e(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe8c(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe89(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe86(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
lea    0x2c22(%rip),%rsi
mov    $0x48,%edx
call   1060 <memcpy@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
movslq -0x94(%rbp),%rax
cmpq   $0x0,-0x40(%rbp,%rax,8)
je     1211 <main+0xd1>
movslq -0x94(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11d0 <main+0x90>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
movslq -0x94(%rbp),%rax
cmpq   $0x0,-0x90(%rbp,%rax,8)
je     1270 <main+0x130>
movslq -0x94(%rbp),%rax
mov    -0x90(%rbp,%rax,8),%rsi
ff
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1229 <main+0xe9>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x94(%rbp)
movslq -0x94(%rbp),%rax
cmpq   $0x0,-0x40(%rbp,%rax,8)
je     132c <main+0x1ec>
movl   $0x0,-0x98(%rbp)
movslq -0x98(%rbp),%rax
cmpq   $0x0,-0x90(%rbp,%rax,8)
je     1318 <main+0x1d8>
movslq -0x94(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
movslq -0x98(%rbp),%rax
mov    -0x90(%rbp,%rax,8),%rsi
ff
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1304 <main+0x1c4>
movslq -0x94(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1331 <main+0x1f1>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    12a5 <main+0x165>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1288 <main+0x148>
jmp    1331 <main+0x1f1>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xec3(%rip),%rbx
mov    %rbx,(%rsp)
lea    0x8(%rsp),%rbp
lea    0xebc(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xeb9(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xeb5(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xeb1(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x0(%rbp),%rbx
add    $0x8,%rbp
test   %rbx,%rbx
jne    1190 <main+0x70>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe21(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe1b(%rip),%rbp
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xe14(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe3a(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%r13
lea    0xdcb(%rip),%r12
mov    %r12,%rdi
lea    0xdeb(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x1bc>
mov    %r12,%rdi
lea    0xddc(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x1bc>
mov    %r12,%rdi
lea    0xdd2(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x1bc>
mov    %r12,%rdi
lea    0xdc7(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x1bc>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x1bc>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x1bc>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x1bc>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12dc <main+0x1bc>
mov    0x0(%r13),%r12
add    $0x8,%r13
test   %r12,%r12
jne    1235 <main+0x115>
jmp    12e4 <main+0x1c4>
mov    %r12,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"1280x800\00"
@.str.1 = [9 x i8] c"1024x768\00"
@.str.2 = [8 x i8] c"800x600\00"
@.str.3 = [8 x i8] c"640x480\00"
@.str.4 = [8 x i8] c"640x400\00"
@.str.5 = [9 x i8] c"1366x768\00"
@.str.6 = [10 x i8] c"1280x1024\00"
@.str.7 = [9 x i8] c"1280x960\00"
@.str.8 = [9 x i8] c"1280x720\00"
@.str.9 = [8 x i8] c"720x400\00"
@__const.main.second = [9 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* null]
@.str.10 = [21 x i8] c"primary resolution:\0A\00"
@.str.11 = [4 x i8] c"%s\0A\00"
@.str.12 = [21 x i8] c"second resolution: \0A\00"
@.str.13 = [36 x i8] c"find the best similar resolution: \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i8*]
%7 = alloca [9 x i8*]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [6 x i8*]* %6 to i8*
%11 = bitcast i8* %10 to [6 x i8*]*
%12 = getelementptr inbounds [6 x i8*], [6 x i8*]* %11, i32 0, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [6 x i8*], [6 x i8*]* %11, i32 0, i32 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds [6 x i8*], [6 x i8*]* %11, i32 0, i32 2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [6 x i8*], [6 x i8*]* %11, i32 0, i32 3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8** %15
%16 = getelementptr inbounds [6 x i8*], [6 x i8*]* %11, i32 0, i32 4
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i32 0, i32 0), i8** %16
%17 = bitcast [9 x i8*]* %7 to i8*
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %8
br label %19
19: ; preds = %25, %2
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i64 0, i64 %21
%23 = load i8*, i8** %22
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %33
25: ; preds = %19
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %8
%32 = add nsw i32 %31, 1
store i32 %32, i32* %8
br label %19
33: ; preds = %19
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %8
br label %35
35: ; preds = %41, %33
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [9 x i8*], [9 x i8*]* %7, i64 0, i64 %37
%39 = load i8*, i8** %38
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %49
41: ; preds = %35
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [9 x i8*], [9 x i8*]* %7, i64 0, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %45)
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %35
49: ; preds = %35
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %8
br label %51
51: ; preds = %84, %49
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i64 0, i64 %53
%55 = load i8*, i8** %54
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %87
57: ; preds = %51
store i32 0, i32* %9
br label %58
58: ; preds = %81, %57
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [9 x i8*], [9 x i8*]* %7, i64 0, i64 %60
%62 = load i8*, i8** %61
%63 = icmp ne i8* %62, null
br i1 %63, label %64, label %84
64: ; preds = %58
%65 = load i32, i32* %8
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i64 0, i64 %66
%68 = load i8*, i8** %67
%69 = load i32, i32* %9
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [9 x i8*], [9 x i8*]* %7, i64 0, i64 %70
%72 = load i8*, i8** %71
%73 = call i64 @strcmp(i8* %68, i8* %72)
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %81
75: ; preds = %64
%76 = load i32, i32* %8
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [6 x i8*], [6 x i8*]* %6, i64 0, i64 %77
%79 = load i8*, i8** %78
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %79)
br label %88
81: ; preds = %64
%82 = load i32, i32* %9
%83 = add nsw i32 %82, 1
store i32 %83, i32* %9
br label %58
84: ; preds = %58
%85 = load i32, i32* %8
%86 = add nsw i32 %85, 1
store i32 %86, i32* %8
br label %51
87: ; preds = %51
br label %88
88: ; preds = %87, %75
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"1280x800\00"
@.str.1 = [9 x i8] c"1024x768\00"
@.str.2 = [8 x i8] c"800x600\00"
@.str.3 = [8 x i8] c"640x480\00"
@.str.4 = [8 x i8] c"640x400\00"
@.str.5 = [9 x i8] c"1366x768\00"
@.str.6 = [10 x i8] c"1280x1024\00"
@.str.7 = [9 x i8] c"1280x960\00"
@.str.8 = [9 x i8] c"1280x720\00"
@.str.9 = [8 x i8] c"720x400\00"
@str = [20 x i8] c"primary resolution:\00"
@str.14 = [20 x i8] c"second resolution: \00"
@str.15 = [35 x i8] c"find the best similar resolution: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i8*]
%4 = bitcast [6 x i8*]* %3 to i8*
%5 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 4
%6 = bitcast i8** %5 to i8*
%7 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 4
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %11
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %2, %13
%14 = phi i64 [ 0, %2 ], [ %17, %13 ]
%15 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %2 ], [ %19, %13 ]
%16 = tail call i32 @puts(i8* %15)
%17 = add nuw i64 %14, 1
%18 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %13
21: ; preds = %13
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.14, i64 0, i64 0))
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.15, i64 0, i64 0))
br label %32
32: ; preds = %21, %58
%33 = phi i64 [ 0, %21 ], [ %59, %58 ]
%34 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %21 ], [ %61, %58 ]
%35 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %63, label %37
37: ; preds = %32
%38 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %63, label %40
40: ; preds = %37
%41 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %63, label %43
43: ; preds = %40
%44 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %63, label %46
46: ; preds = %43
%47 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %63, label %49
49: ; preds = %46
%50 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %63, label %52
52: ; preds = %49
%53 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %63, label %55
55: ; preds = %52
%56 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %63, label %58
58: ; preds = %55
%59 = add nuw i64 %33, 1
%60 = getelementptr inbounds [6 x i8*], [6 x i8*]* %3, i64 0, i64 %59
%61 = load i8*, i8** %60
%62 = icmp eq i8* %61, null
br i1 %62, label %65, label %32
63: ; preds = %55, %52, %49, %46, %43, %40, %37, %32
%64 = tail call i32 @puts(i8* dereferenceable(1) %34)
br label %65
65: ; preds = %58, %63
ret i32 0
}