#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_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int find_elem(int **, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int data[3][3] = {{10, 20, 30}, {40, 50, 60}, {70, 80, 90}};
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <number>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  int result = find_elem(data, atoi(argv[1]));
  if (result == -1)
    printf("Not found\n");
  else
    printf("Found '%d'\n", result);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe7f(%rip),%rsi
mov    $0x24,%edx
call   1060 <memcpy@plt>
cmpl   $0x2,-0x8(%rbp)
je     11bf <main+0x5f>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe78(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%esi
call   1030 <find_elem@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0xffffffff,-0x44(%rbp)
jne    11ff <main+0x9f>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1210 <main+0xb0>
mov    -0x44(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xeb6(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe7f(%rip),%xmm0
movaps %xmm0,(%rsp)
cmp    $0x2,%edi
jne    11ce <main+0x6e>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %rsp,%rdi
mov    %eax,%esi
call   1040 <find_elem@plt>
cmp    $0xffffffff,%eax
je     11b4 <main+0x54>
lea    0xe8f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11c0 <main+0x60>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
ret
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe43(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@__const.main.data = [3 x [3 x i32]] [[3 x i32] [i32 10, i32 20, i32 30], [3 x i32] [i32 40, i32 50, i32 60], [3 x i32] [i32 70, i32 80, i32 90]]
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <number>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [11 x i8] c"Not found\0A\00"
@.str.2 = [12 x i8] c"Found '%d'\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x [3 x i32]]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [3 x [3 x i32]]* %6 to i8*
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 0
%21 = bitcast [3 x i32]* %20 to i32**
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
%26 = call i32 @find_elem(i32** %21, i32 %25)
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %19
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %34
31: ; preds = %19
%32 = load i32, i32* %7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %29
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}

LLVM IR (-O2):
@__const.main.data = [3 x [3 x i32]] [[3 x i32] [i32 10, i32 20, i32 30], [3 x i32] [i32 40, i32 50, i32 60], [3 x i32] [i32 70, i32 80, i32 90]]
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <number>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [12 x i8] c"Found '%d'\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [10 x i8] c"Not found\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [3 x [3 x i32]]
%4 = bitcast [3 x [3 x i32]]* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = bitcast [3 x [3 x i32]]* %3 to i32**
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = call i32 @find_elem(i32** %13, i32 %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %23
21: ; preds = %12
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %23
23: ; preds = %21, %19
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}