xunge/DecIR huggingface dataset:
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ mdbm_set_log_filename(char *);
void mdbm_log_init_file() {
  static int initialized = 0;
  if (!initialized) {
    char *dest = getenv("MDBM_LOG_DEST_NAME");
    mdbm_set_log_filename(dest);
    initialized = 1;
  }
}


x86 assembly (clang, -O0):
<mdbm_log_init_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f05(%rip)
jne    1158 <mdbm_log_init_file+0x38>
lea    0xec4(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <mdbm_set_log_filename@plt>
movl   $0x1,0x2edc(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdbm_log_init_file>:
push   %rax
cmpb   $0x0,0x2f0c(%rip)
jne    1145 <mdbm_log_init_file+0x25>
lea    0xecf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1040 <mdbm_set_log_filename@plt>
movb   $0x1,0x2eef(%rip)
pop    %rax
ret

LLVM IR (-O0):
@mdbm_log_init_file.initialized = internal global i32 0
@.str = [19 x i8] c"MDBM_LOG_DEST_NAME\00"
define void @mdbm_log_init_file() {
%1 = alloca i8*
%2 = load i32, i32* @mdbm_log_init_file.initialized
%3 = icmp ne i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = call i8* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @mdbm_set_log_filename(i8* %6)
store i32 1, i32* @mdbm_log_init_file.initialized
br label %8
8: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@mdbm_log_init_file.initialized = internal unnamed_addr global i1 false
@.str = [19 x i8] c"MDBM_LOG_DEST_NAME\00"
define void @mdbm_log_init_file() {
%1 = load i1, i1* @mdbm_log_init_file.initialized
br i1 %1, label %5, label %2
2: ; preds = %0
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @mdbm_set_log_filename(i8* %3)
store i1 true, i1* @mdbm_log_init_file.initialized
br label %5
5: ; preds = %2, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void my_printf(char *str) { printf(str); }


x86 assembly (clang, -O0):
<my_printf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_printf>:
jmp    1030 <printf@plt>

LLVM IR (-O0):
define void @my_printf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* %3)
ret void
}

LLVM IR (-O2):
define void @my_printf(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mvprintw(int, int, char *, char *);
void dispval(char *val) { mvprintw(2, 7, "%s", val); }


x86 assembly (clang, -O0):
<dispval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x2,%edi
mov    $0x7,%esi
lea    0xecf(%rip),%rdx
call   1030 <mvprintw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dispval>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdx
mov    $0x2,%edi
mov    $0x7,%esi
jmp    1030 <mvprintw@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @dispval(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @mvprintw(i32 2, i32 7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @dispval(i8* %0) {
%2 = tail call i32 @mvprintw(i32 2, i32 7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int ispravna(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char **);
int main() {
  char nizc[100];
  printf("Unesite zeljenu adresu: ");
  scanf("%s", &nizc);
  printf("%d", ispravna(nizc));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1040 <ispravna@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <ispravna@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Unesite zeljenu adresu: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [100 x i8]* %2 to i8**
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 @ispravna(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Unesite zeljenu adresu: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [100 x i8]* %1 to i8**
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%6 = call i32 @ispravna(i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int const, unsigned int const,
                          unsigned int const, unsigned int const);
void display_polynomial(const unsigned *p) {
  printf("(%x x^3 + %x x^2 + %x x + %x)", p[3], p[2], p[1], p[0]);
}


x86 assembly (clang, -O0):
<display_polynomial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%r8d
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_polynomial>:
mov    0xc(%rdi),%esi
mov    0x8(%rdi),%edx
mov    (%rdi),%r8d
mov    0x4(%rdi),%ecx
lea    0xedd(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"(%x x^3 + %x x^2 + %x x + %x)\00"
define void @display_polynomial(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 2
%8 = load i32, i32* %7
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %8, i32 %11, i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"(%x x^3 + %x x^2 + %x x + %x)\00"
define void @display_polynomial(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = getelementptr inbounds i32, i32* %0, i64 2
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = load i32, i32* %0
%9 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5, i32 %7, i32 %8)
ret void
}
int toupper(int c) {
  if ((c >= 'a') && (c <= 'z'))
    return c - 32;
  return c;
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     1129 <toupper+0x29>
cmpl   $0x7a,-0x8(%rbp)
jg     1129 <toupper+0x29>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <toupper+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @toupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 122
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 32
store i32 %11, i32* %2
br label %14
12: ; preds = %6, %1
%13 = load i32, i32* %3
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
int checkPresence(int *set, int elem, int len) {
  int i;
  for (i = 0; i < len; i++)
    if (set[i] == elem) {
      return 0;
      break;
    }
  return 1;
}


x86 assembly (clang, -O0):
<checkPresence>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1154 <checkPresence+0x54>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    1141 <checkPresence+0x41>
movl   $0x0,-0x4(%rbp)
jmp    115b <checkPresence+0x5b>
jmp    1146 <checkPresence+0x46>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <checkPresence+0x15>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkPresence>:
mov    $0x1,%eax
test   %edx,%edx
jle    111e <checkPresence+0x1e>
mov    %edx,%ecx
xor    %edx,%edx
nopl   (%rax)
cmp    %esi,(%rdi,%rdx,4)
je     111f <checkPresence+0x1f>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1110 <checkPresence+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @checkPresence(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %23, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load i32*, i32** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32, i32* %6
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %13
store i32 0, i32* %4
br label %27
22: ; preds = %13
br label %23
23: ; preds = %22
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %9
26: ; preds = %9
store i32 1, i32* %4
br label %27
27: ; preds = %26, %21
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @checkPresence(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %14, %6
br i1 %8, label %15, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %14, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, %1
%14 = add nuw nsw i64 %10, 1
br i1 %13, label %15, label %7
15: ; preds = %9, %7, %3
%16 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %16
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) {
  int ret;
  ret = vsnprintf(buf, n, format, args);
  if (ret >= n || ret == -1)
    return (-1);
  return (ret);
}


x86 assembly (clang, -O0):
<BIO_vsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <vsnprintf@plt>
mov    %eax,-0x28(%rbp)
movslq -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1156 <BIO_vsnprintf+0x46>
cmpl   $0xffffffff,-0x28(%rbp)
jne    1162 <BIO_vsnprintf+0x52>
movl   $0xffffffff,-0x4(%rbp)
jmp    1168 <BIO_vsnprintf+0x58>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BIO_vsnprintf>:
push   %rbx
mov    %rsi,%rbx
call   1030 <vsnprintf@plt>
movslq %eax,%rcx
cmp    %rbx,%rcx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
cmp    $0xffffffff,%ecx
cmove  %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @BIO_vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load i8*, i8** %8
%14 = load i32, i32* %9
%15 = call i32 @vsnprintf(i8* %11, i64 %12, i8* %13, i32 %14)
store i32 %15, i32* %10
%16 = load i32, i32* %10
%17 = sext i32 %16 to i64
%18 = load i64, i64* %7
%19 = icmp uge i64 %17, %18
br i1 %19, label %23, label %20
20: ; preds = %4
%21 = load i32, i32* %10
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %24
23: ; preds = %20, %4
store i32 -1, i32* %5
br label %26
24: ; preds = %20
%25 = load i32, i32* %10
store i32 %25, i32* %5
br label %26
26: ; preds = %24, %23
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @BIO_vsnprintf(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
%6 = sext i32 %5 to i64
%7 = icmp uge i64 %6, %1
%8 = icmp eq i32 %5, -1
%9 = or i1 %8, %7
%10 = select i1 %9, i32 -1, i32 %5
ret i32 %10
}
void gl2psPrintTeXFinalPrimitive(void) {}


x86 assembly (clang, -O0):
<gl2psPrintTeXFinalPrimitive>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl2psPrintTeXFinalPrimitive>:
ret

LLVM IR (-O0):
define void @gl2psPrintTeXFinalPrimitive() {
ret void
}

LLVM IR (-O2):
define void @gl2psPrintTeXFinalPrimitive() {
ret void
}
/* Variables and functions */
char *strcpy(char *to, const char *from) {
  char *ret = to;
  while ((*to++ = *from++) != '\0')
    continue;
  return ret;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1147 <strcpy+0x47>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

LLVM IR (-O0):
define i8* @strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %15, %2
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %4
%10 = load i8, i8* %8
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
store i8 %10, i8* %11
%13 = sext i8 %10 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %7
br label %7
16: ; preds = %7
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Variables and functions */
int dal_reg_tbl_read(unsigned int, unsigned int, unsigned int *, unsigned int);
int egress_reg_tbl_get(unsigned int dev_id, unsigned int reg_addr,
                       unsigned int *pvalue, unsigned int width) {
  return dal_reg_tbl_read(dev_id, reg_addr + 0x0, pvalue, width);
}


x86 assembly (clang, -O0):
<egress_reg_tbl_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x0,%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <dal_reg_tbl_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<egress_reg_tbl_get>:
jmp    1030 <dal_reg_tbl_read@plt>

LLVM IR (-O0):
define i32 @egress_reg_tbl_get(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = add i32 %10, 0
%12 = load i32*, i32** %7
%13 = load i32, i32* %8
%14 = call i32 @dal_reg_tbl_read(i32 %9, i32 %11, i32* %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @egress_reg_tbl_get(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = tail call i32 @dal_reg_tbl_read(i32 %0, i32 %1, i32* %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
scalar_t__ _uname(char *);
int main(int argc, char *argv[]) {
  (void)argc;
  return (_uname(argv[0]) == 0) ? 0 : 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <_uname@plt>
mov    %rax,%rdx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    (%rsi),%rdi
call   1030 <_uname@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
add    %ecx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i64 @_uname(i8* %9)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 0, i32 2
ret i32 %13
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i64 @_uname(i8* %3)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 0, i32 2
ret i32 %6
}
unsigned char *reformat_long(unsigned char *ptr) {
  register unsigned long x;
  register unsigned long *temp;
  x = (unsigned long)*ptr;
  x |= (((unsigned long)*(ptr + 1)) << 8);
  x |= (((unsigned long)*(ptr + 2)) << 16);
  x |= (((unsigned long)*(ptr + 3)) << 24);
  temp = (unsigned long *)ptr;
  *temp++ = x;
  return ((unsigned char *)temp);
}


x86 assembly (clang, -O0):
<reformat_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x10,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
shl    $0x18,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reformat_long>:
mov    (%rdi),%eax
mov    %rax,(%rdi)
lea    0x8(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @reformat_long(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
store i64 %7, i64* %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i64
%12 = shl i64 %11, 8
%13 = load i64, i64* %3
%14 = or i64 %13, %12
store i64 %14, i64* %3
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i64
%19 = shl i64 %18, 16
%20 = load i64, i64* %3
%21 = or i64 %20, %19
store i64 %21, i64* %3
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 3
%24 = load i8, i8* %23
%25 = zext i8 %24 to i64
%26 = shl i64 %25, 24
%27 = load i64, i64* %3
%28 = or i64 %27, %26
store i64 %28, i64* %3
%29 = load i8*, i8** %2
%30 = bitcast i8* %29 to i64*
store i64* %30, i64** %4
%31 = load i64, i64* %3
%32 = load i64*, i64** %4
%33 = getelementptr inbounds i64, i64* %32, i32 1
store i64* %33, i64** %4
store i64 %31, i64* %32
%34 = load i64*, i64** %4
%35 = bitcast i64* %34 to i8*
ret i8* %35
}

LLVM IR (-O2):
define i8* @reformat_long(i8* %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = shl nuw nsw i64 %6, 8
%8 = or i64 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i64
%12 = shl nuw nsw i64 %11, 16
%13 = or i64 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i64
%17 = shl nuw nsw i64 %16, 24
%18 = or i64 %13, %17
%19 = bitcast i8* %0 to i64*
%20 = getelementptr inbounds i8, i8* %0, i64 8
store i64 %18, i64* %19
ret i8* %20
}
int int_size() {
  unsigned int bits;
  int size = 0;
  bits = ~0;
  while (bits) {
    ++size;
    bits >>= 1;
  }
  return size;
}


x86 assembly (clang, -O0):
<int_size>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x8(%rbp)
movl   $0xffffffff,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1133 <int_size+0x33>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <int_size+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_size>:
mov    $0x20,%eax
ret

LLVM IR (-O0):
define i32 @int_size() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
store i32 -1, i32* %1
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
%9 = load i32, i32* %1
%10 = lshr i32 %9, 1
store i32 %10, i32* %1
br label %3
11: ; preds = %3
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @int_size() {
ret i32 32
}
int priority(char c) {
  if (c == '/' || c == '*' || c == '%')
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<priority>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
je     1131 <priority+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     1131 <priority+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x25,%eax
jne    113d <priority+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <priority+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<priority>:
cmp    $0x2f,%dil
ja     1120 <priority+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x842000000000,%rdx
bt     %rcx,%rdx
jae    1120 <priority+0x20>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @priority(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 47
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 42
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 37
br i1 %14, label %15, label %16
15: ; preds = %11, %7, %1
store i32 1, i32* %2
br label %17
16: ; preds = %11
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @priority(i8 signext %0) {
switch i8 %0, label %2 [
i8 47, label %3
i8 42, label %3
i8 37, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int _stricmp(char const *, char const *);
int strcasecmp(const char *a, const char *b) { return _stricmp(a, b); }


x86 assembly (clang, -O0):
<strcasecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <_stricmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcasecmp>:
jmp    1030 <_stricmp@plt>

LLVM IR (-O0):
define i32 @strcasecmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @_stricmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @strcasecmp(i8* %0, i8* %1) {
%3 = tail call i32 @_stricmp(i8* %0, i8* %1)
ret i32 %3
}
void webCloseDb() {}


x86 assembly (clang, -O0):
<webCloseDb>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<webCloseDb>:
ret

LLVM IR (-O0):
define void @webCloseDb() {
ret void
}

LLVM IR (-O2):
define void @webCloseDb() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SEGGER_RTT_Write(int /*<<< orphan*/, char *, int);
int _write(int file, char *ptr, int len) {
  (void)file;
  SEGGER_RTT_Write(0, ptr, len);
  return len;
}


x86 assembly (clang, -O0):
<_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %edi,%edi
call   1030 <SEGGER_RTT_Write@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write>:
push   %rbx
mov    %edx,%ebx
xor    %edi,%edi
call   1030 <SEGGER_RTT_Write@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @SEGGER_RTT_Write(i32 0, i8* %8, i32 %9)
%11 = load i32, i32* %6
ret i32 %11
}

LLVM IR (-O2):
define i32 @_write(i32 %0, i8* %1, i32 returned %2) {
%4 = tail call i32 @SEGGER_RTT_Write(i32 0, i8* %1, i32 %2)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ XKeyboardState;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XKeyboardState(void *_p) {
  if (_p == NULL)
    abort();
  free((XKeyboardState *)_p);
}


x86 assembly (clang, -O0):
<free_XKeyboardState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XKeyboardState+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XKeyboardState>:
test   %rdi,%rdi
je     112a <free_XKeyboardState+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XKeyboardState(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XKeyboardState(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ handle_54(int /*<<< orphan*/);
int gen_54() {
  handle_54(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_54>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_54@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_54>:
push   %rax
xor    %edi,%edi
call   1030 <handle_54@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gen_54() {
%1 = call i32 @handle_54(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_54() {
%1 = tail call i32 @handle_54(i32 0)
ret i32 0
}
int is_valid_pubkey_algo(const int algo) {
  switch (algo) {
  case 1:
  case 2:
  case 3:
  case 16:
  case 17:
  case 20:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_valid_pubkey_algo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffff,%eax
sub    $0x3,%eax
jb     1143 <is_valid_pubkey_algo+0x43>
jmp    111e <is_valid_pubkey_algo+0x1e>
mov    -0xc(%rbp),%eax
add    $0xfffffff0,%eax
sub    $0x2,%eax
jb     1143 <is_valid_pubkey_algo+0x43>
jmp    1132 <is_valid_pubkey_algo+0x32>
mov    -0xc(%rbp),%eax
sub    $0x14,%eax
jne    114f <is_valid_pubkey_algo+0x4f>
jmp    1143 <is_valid_pubkey_algo+0x43>
movl   $0x1,-0x4(%rbp)
jmp    1156 <is_valid_pubkey_algo+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_pubkey_algo>:
cmp    $0x14,%edi
ja     1115 <is_valid_pubkey_algo+0x15>
mov    $0x1,%eax
mov    $0x13000e,%ecx
bt     %edi,%ecx
jae    1115 <is_valid_pubkey_algo+0x15>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @is_valid_pubkey_algo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 1, label %5
i32 2, label %5
i32 3, label %5
i32 16, label %5
i32 17, label %5
i32 20, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_valid_pubkey_algo(i32 %0) {
switch i32 %0, label %2 [
i32 1, label %3
i32 2, label %3
i32 3, label %3
i32 16, label %3
i32 17, label %3
i32 20, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Msp430GpioC__12__GeneralIO__clr();
void SensirionSht11LogicP__0__DATA__clr(void) {
  Msp430GpioC__12__GeneralIO__clr();
}


x86 assembly (clang, -O0):
<SensirionSht11LogicP__0__DATA__clr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <Msp430GpioC__12__GeneralIO__clr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensirionSht11LogicP__0__DATA__clr>:
xor    %eax,%eax
jmp    1030 <Msp430GpioC__12__GeneralIO__clr@plt>

LLVM IR (-O0):
define void @SensirionSht11LogicP__0__DATA__clr() {
%1 = call i32 (...) @Msp430GpioC__12__GeneralIO__clr()
ret void
}

LLVM IR (-O2):
define void @SensirionSht11LogicP__0__DATA__clr() {
%1 = tail call i32 (...) @Msp430GpioC__12__GeneralIO__clr()
ret void
}
int fMax7(int a, int b) {
  int pair[2] = {a, b};
  return pair[a < b];
}


x86 assembly (clang, -O0):
<fMax7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
cltq
mov    -0x10(%rbp,%rax,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fMax7>:
mov    %edi,-0x8(%rsp)
mov    %esi,-0x4(%rsp)
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
mov    -0x8(%rsp,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @fMax7(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%7 = load i32, i32* %3
store i32 %7, i32* %6
%8 = getelementptr inbounds i32, i32* %6, i64 1
%9 = load i32, i32* %4
store i32 %9, i32* %8
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
%13 = zext i1 %12 to i32
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 %14
%16 = load i32, i32* %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @fMax7(i32 %0, i32 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 %0, i32* %5
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %1, i32* %6
%7 = icmp slt i32 %0, %1
%8 = zext i1 %7 to i64
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 %8
%10 = load i32, i32* %9
ret i32 %10
}
/* Variables and functions */
char *japi_fileselect(int, char *, char *, char *);
char *j_fileselect(int arg0, char *arg1, char *arg2, char *arg3) {
  return (japi_fileselect(arg0, arg1, arg2, arg3));
}


x86 assembly (clang, -O0):
<j_fileselect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <japi_fileselect@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_fileselect>:
jmp    1030 <japi_fileselect@plt>

LLVM IR (-O0):
define i8* @j_fileselect(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = call i8* @japi_fileselect(i32 %9, i8* %10, i8* %11, i8* %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @j_fileselect(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i8* @japi_fileselect(i32 %0, i8* %1, i8* %2, i8* %3)
ret i8* %5
}
int gcd(int x, int y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <gcd+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <gcd+0x37>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <gcd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @gcd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %16
10: ; preds = %2
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = srem i32 %12, %13
%15 = call i32 @gcd(i32 %11, i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %10, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Variables and functions */
int getcpucount();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", getcpucount());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getcpucount@plt>
mov    %eax,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getcpucount@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getcpucount()
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getcpucount()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
char *allocate_something(int);
char *foo() { return allocate_something(100); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x64,%edi
call   1030 <allocate_something@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0x64,%edi
jmp    1030 <allocate_something@plt>

LLVM IR (-O0):
define i8* @foo() {
%1 = call i8* @allocate_something(i32 100)
ret i8* %1
}

LLVM IR (-O2):
define i8* @foo() {
%1 = tail call i8* @allocate_something(i32 100)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const, int);
int main(int argc, char *argv[]) {
  const int i = 1;
  int *p;
  p = &i;
  *p = 2;
  printf("%d %d\n", i, *p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xeb4(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32* %6, i32** %7
%8 = load i32*, i32** %7
store i32 2, i32* %8
%9 = load i32*, i32** %7
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32 2)
ret i32 0
}
void g_rand_set_seed_array() {}


x86 assembly (clang, -O0):
<g_rand_set_seed_array>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_rand_set_seed_array>:
ret

LLVM IR (-O0):
define void @g_rand_set_seed_array() {
ret void
}

LLVM IR (-O2):
define void @g_rand_set_seed_array() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ decode_signal(int /*<<< orphan*/ const *, char *);
int /*<<< orphan*/ test_msg(char *, int, char *);
void __show_sigset(int line, const sigset_t *s) {
  char buf[sizeof(sigset_t) * 2 + 1] = {};
  decode_signal(s, buf);
  test_msg("sigset at %4d: %s\n", line, buf);
}


x86 assembly (clang, -O0):
<__show_sigset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x19(%rbp),%rdi
xor    %esi,%esi
mov    $0x9,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rdi
lea    -0x19(%rbp),%rsi
call   1050 <decode_signal@plt>
mov    -0x4(%rbp),%esi
lea    -0x19(%rbp),%rdx
lea    0xe96(%rip),%rdi
call   1040 <test_msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__show_sigset>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
movb   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%r14
mov    %rsi,%rdi
mov    %r14,%rsi
call   1040 <decode_signal@plt>
lea    0xeb2(%rip),%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <test_msg@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"sigset at %4d: %s\0A\00"
define void @__show_sigset(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [9 x i8]
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = bitcast [9 x i8]* %5 to i8*
%7 = load i32*, i32** %4
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%9 = call i32 @decode_signal(i32* %7, i8* %8)
%10 = load i32, i32* %3
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%12 = call i32 @test_msg(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"sigset at %4d: %s\0A\00"
define void @__show_sigset(i32 %0, i32* %1) {
%3 = alloca [9 x i8]
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%5 = call i32 @decode_signal(i32* %1, i8* %4)
%6 = call i32 @test_msg(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %4)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void I2CMasterEnable(uint32_t ui32Base) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000020))) |= 0x00000010;
}


x86 assembly (clang, -O0):
<I2CMasterEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%eax
cltq
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterEnable>:
movslq %edi,%rax
orl    $0x10,0x20(%rax)
ret

LLVM IR (-O0):
define void @I2CMasterEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 32
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, 16
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @I2CMasterEnable(i32 %0) {
%2 = add nsw i32 %0, 32
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = or i32 %5, 16
store volatile i32 %6, i32* %4
ret void
}
OP(dd, ab) { op_ab(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <op_ab@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP>:
xor    %eax,%eax
jmp    1030 <op_ab@plt>

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (...) @op_ab()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_ab()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ output(char *);
void printApmBatFillInfo(const char *cmd) {
  (void)cmd;
  output("Battery charge\t0\t100\t%%\n");
}


x86 assembly (clang, -O0):
<printApmBatFillInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printApmBatFillInfo>:
lea    0xee9(%rip),%rdi
jmp    1030 <output@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Battery charge\090\09100\09%%\0A\00"
define void @printApmBatFillInfo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @output(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Battery charge\090\09100\09%%\0A\00"
define void @printApmBatFillInfo(i8* nocapture readnone %0) {
%2 = tail call i32 @output(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
int test2(const char *c) { return c[1] * 3; }


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
imul   $0x3,%eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
movsbl 0x1(%rdi),%eax
lea    (%rax,%rax,2),%eax
ret

LLVM IR (-O0):
define i32 @test2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = mul nsw i32 %6, 3
ret i32 %7
}

LLVM IR (-O2):
define i32 @test2(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = mul nsw i32 %4, 3
ret i32 %5
}
int t_after(int rep, int count, int outsafety) {
  if (count == 0 && (rep == 01 || rep == 02)) {
    return 1;
  }
  if (rep != 00) {
    if (outsafety <= 1)
      return 1;
    return 2;
  }
  return outsafety;
}


x86 assembly (clang, -O0):
<t_after>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1137 <t_after+0x37>
cmpl   $0x1,-0x8(%rbp)
je     112b <t_after+0x2b>
cmpl   $0x2,-0x8(%rbp)
jne    1137 <t_after+0x37>
movl   $0x1,-0x4(%rbp)
jmp    1169 <t_after+0x69>
cmpl   $0x0,-0x8(%rbp)
je     1163 <t_after+0x63>
cmpl   $0x1,-0x10(%rbp)
jg     1157 <t_after+0x57>
movl   $0x1,-0x4(%rbp)
jmp    1169 <t_after+0x69>
movl   $0x2,-0x4(%rbp)
jmp    1169 <t_after+0x69>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_after>:
test   %esi,%esi
jne    1112 <t_after+0x12>
lea    -0x1(%rdi),%ecx
mov    $0x1,%eax
cmp    $0x2,%ecx
jae    1112 <t_after+0x12>
ret
test   %edi,%edi
je     1126 <t_after+0x26>
xor    %ecx,%ecx
cmp    $0x2,%edx
setl   %cl
mov    $0x2,%eax
sub    %ecx,%eax
ret
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @t_after(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 1
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %17
16: ; preds = %13, %10
store i32 1, i32* %4
br label %27
17: ; preds = %13, %3
%18 = load i32, i32* %5
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %7
%22 = icmp sle i32 %21, 1
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 1, i32* %4
br label %27
24: ; preds = %20
store i32 2, i32* %4
br label %27
25: ; preds = %17
%26 = load i32, i32* %7
store i32 %26, i32* %4
br label %27
27: ; preds = %25, %24, %23, %16
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @t_after(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
%5 = add i32 %0, -1
%6 = icmp ult i32 %5, 2
%7 = and i1 %4, %6
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = icmp eq i32 %0, 0
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = icmp slt i32 %2, 2
%12 = select i1 %11, i32 1, i32 2
br label %13
13: ; preds = %8, %10, %3
%14 = phi i32 [ 1, %3 ], [ %12, %10 ], [ %2, %8 ]
ret i32 %14
}
void lh_doall(void) {}


x86 assembly (clang, -O0):
<lh_doall>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lh_doall>:
ret

LLVM IR (-O0):
define void @lh_doall() {
ret void
}

LLVM IR (-O2):
define void @lh_doall() {
ret void
}
/* Type definitions */
struct compat_semaphore {
  int dummy;
};

/* Variables and functions */
int compat_down_interruptible(struct compat_semaphore *);
int down_interruptible(struct compat_semaphore *sem) {
  return compat_down_interruptible(sem);
}


x86 assembly (clang, -O0):
<down_interruptible>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <compat_down_interruptible@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<down_interruptible>:
jmp    1030 <compat_down_interruptible@plt>

LLVM IR (-O0):
%struct.compat_semaphore = type { i32 }
define i32 @down_interruptible(%struct.compat_semaphore* %0) {
%2 = alloca %struct.compat_semaphore*
store %struct.compat_semaphore* %0, %struct.compat_semaphore** %2
%3 = load %struct.compat_semaphore*, %struct.compat_semaphore** %2
%4 = call i32 @compat_down_interruptible(%struct.compat_semaphore* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.compat_semaphore = type { i32 }
define i32 @down_interruptible(%struct.compat_semaphore* %0) {
%2 = tail call i32 @compat_down_interruptible(%struct.compat_semaphore* %0)
ret i32 %2
}