xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cbuf_capacity(char **, size_t *, size_t);
void cbuf_append_char(char **buf, size_t *lenptr, size_t *sizeptr, char c) {
  cbuf_capacity(buf, sizeptr, *lenptr + 1);
  (*buf)[(*lenptr)++] = c;
  (*buf)[*lenptr] = '\0';
}


x86 assembly (clang, -O0):
<cbuf_append_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
add    $0x1,%rdx
call   1030 <cbuf_capacity@plt>
mov    -0x19(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rsi
mov    (%rsi),%rcx
mov    %rcx,%rdi
add    $0x1,%rdi
mov    %rdi,(%rsi)
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf_append_char>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    (%rsi),%rax
add    $0x1,%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <cbuf_capacity@plt>
mov    0x0(%rbp),%rax
mov    (%rbx),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rbx)
mov    %r14b,(%rax,%rcx,1)
mov    0x0(%rbp),%rax
mov    (%rbx),%rcx
movb   $0x0,(%rax,%rcx,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @cbuf_append_char(i8** %0, i64* %1, i64* %2, i8 signext %3) {
%5 = alloca i8**
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i8
store i8** %0, i8*** %5
store i64* %1, i64** %6
store i64* %2, i64** %7
store i8 %3, i8* %8
%9 = load i8**, i8*** %5
%10 = load i64*, i64** %7
%11 = load i64*, i64** %6
%12 = load i64, i64* %11
%13 = add i64 %12, 1
%14 = call i32 @cbuf_capacity(i8** %9, i64* %10, i64 %13)
%15 = load i8, i8* %8
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = load i64*, i64** %6
%19 = load i64, i64* %18
%20 = add i64 %19, 1
store i64 %20, i64* %18
%21 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 %15, i8* %21
%22 = load i8**, i8*** %5
%23 = load i8*, i8** %22
%24 = load i64*, i64** %6
%25 = load i64, i64* %24
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 0, i8* %26
ret void
}

LLVM IR (-O2):
define void @cbuf_append_char(i8** %0, i64* nocapture %1, i64* %2, i8 signext %3) {
%5 = load i64, i64* %1
%6 = add i64 %5, 1
%7 = tail call i32 @cbuf_capacity(i8** %0, i64* %2, i64 %6)
%8 = load i8*, i8** %0
%9 = load i64, i64* %1
%10 = add i64 %9, 1
store i64 %10, i64* %1
%11 = getelementptr inbounds i8, i8* %8, i64 %9
store i8 %3, i8* %11
%12 = load i8*, i8** %0
%13 = load i64, i64* %1
%14 = getelementptr inbounds i8, i8* %12, i64 %13
store i8 0, i8* %14
ret void
}
int sort_utils_int_cmp(const void *const a, const void *const b) {
  const int *const x = (const int *const)a;
  const int *const y = (const int *const)b;
  return (*x > *y) - (*x < *y);
}


x86 assembly (clang, -O0):
<sort_utils_int_cmp>:
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,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
mov    -0x20(%rbp),%rdx
cmp    (%rdx),%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort_utils_int_cmp>:
mov    (%rdi),%ecx
xor    %eax,%eax
xor    %edx,%edx
cmp    (%rsi),%ecx
setg   %al
setl   %dl
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @sort_utils_int_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = icmp sgt i32 %12, %14
%16 = zext i1 %15 to i32
%17 = load i32*, i32** %5
%18 = load i32, i32* %17
%19 = load i32*, i32** %6
%20 = load i32, i32* %19
%21 = icmp slt i32 %18, %20
%22 = zext i1 %21 to i32
%23 = sub nsw i32 %16, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @sort_utils_int_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
%9 = icmp slt i32 %5, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
void reportError2(void *p) {}


x86 assembly (clang, -O0):
<reportError2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @reportError2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @reportError2(i8* nocapture %0) {
ret void
}
int ft_ishexa(int c) {
  if (c >= '0' && c <= '9')
    return (1);
  else if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<ft_ishexa>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x30,-0x8(%rbp)
jl     1127 <ft_ishexa+0x27>
cmpl   $0x39,-0x8(%rbp)
jg     1127 <ft_ishexa+0x27>
movl   $0x1,-0x4(%rbp)
jmp    1162 <ft_ishexa+0x62>
cmpl   $0x61,-0x8(%rbp)
jl     113b <ft_ishexa+0x3b>
cmpl   $0x66,-0x8(%rbp)
jle    114f <ft_ishexa+0x4f>
cmpl   $0x41,-0x8(%rbp)
jl     115b <ft_ishexa+0x5b>
cmpl   $0x46,-0x8(%rbp)
jg     115b <ft_ishexa+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    1162 <ft_ishexa+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_ishexa>:
lea    -0x30(%rdi),%ecx
mov    $0x1,%eax
cmp    $0xa,%ecx
jb     1125 <ft_ishexa+0x25>
add    $0xffffffbf,%edi
cmp    $0x25,%edi
ja     1126 <ft_ishexa+0x26>
movabs $0x3f0000003f,%rcx
bt     %rdi,%rcx
jae    1126 <ft_ishexa+0x26>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ft_ishexa(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 57
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %24
10: ; preds = %6, %1
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 97
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 102
br i1 %15, label %22, label %16
16: ; preds = %13, %10
%17 = load i32, i32* %3
%18 = icmp sge i32 %17, 65
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %3
%21 = icmp sle i32 %20, 70
br i1 %21, label %22, label %23
22: ; preds = %19, %13
store i32 1, i32* %2
br label %24
23: ; preds = %19, %16
store i32 0, i32* %2
br label %24
24: ; preds = %23, %22, %9
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @ft_ishexa(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %6, label %4
4: ; preds = %1
switch i32 %0, label %5 [
i32 102, label %6
i32 101, label %6
i32 100, label %6
i32 99, label %6
i32 98, label %6
i32 97, label %6
i32 70, label %6
i32 69, label %6
i32 68, label %6
i32 67, label %6
i32 66, label %6
i32 65, label %6
]
5: ; preds = %4
br label %6
6: ; preds = %4, %4, %4, %4, %4, %4, %4, %4, %4, %4, %4, %4, %1, %5
%7 = phi i32 [ 0, %5 ], [ 1, %1 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ], [ 1, %4 ]
ret i32 %7
}
/* Variables and functions */
int dup(int);
int errno;
int __sulong_posix_dup(int oldfd) {
  {
    int native_errno = errno;
    int result = dup(oldfd);
    if (result == (int)-1) {
      result = (int)(long)-errno;
    }
    errno = native_errno;
    return result;
  }
}


x86 assembly (clang, -O0):
<__sulong_posix_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <dup@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    114c <__sulong_posix_dup+0x3c>
xor    %eax,%eax
mov    0x2e9b(%rip),%rcx
sub    (%rcx),%eax
cltq
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    0x2e8a(%rip),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sulong_posix_dup>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ec6(%rip),%rbx
mov    (%rbx),%ebp
call   1030 <dup@plt>
xor    %ecx,%ecx
sub    (%rbx),%ecx
cmp    $0xffffffff,%eax
cmove  %ecx,%eax
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @__sulong_posix_dup(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* @errno
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @dup(i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %15
10: ; preds = %1
%11 = load i32, i32* @errno
%12 = sub nsw i32 0, %11
%13 = sext i32 %12 to i64
%14 = trunc i64 %13 to i32
store i32 %14, i32* %4
br label %15
15: ; preds = %10, %1
%16 = load i32, i32* %3
store i32 %16, i32* @errno
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @__sulong_posix_dup(i32 %0) {
%2 = load i32, i32* @errno
%3 = tail call i32 @dup(i32 %0)
%4 = icmp eq i32 %3, -1
%5 = load i32, i32* @errno
%6 = sub nsw i32 0, %5
%7 = select i1 %4, i32 %6, i32 %3
store i32 %2, i32* @errno
ret i32 %7
}
unsigned int str_strlen(const char *str) {
  const char *s;
  for (s = str; *s; s++)
    ;
  return ((unsigned int)(s - str));
}


x86 assembly (clang, -O0):
<str_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1133 <str_strlen+0x33>
jmp    1122 <str_strlen+0x22>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <str_strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <str_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @str_strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void usage() {
  puts("Usage: ./flow <ip address> [<port>] [--rate <rate>] [--type (good | "
       "bad)]");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [74 x i8] c"Usage: ./flow <ip address> [<port>] [--rate <rate>] [--type (good | bad)]\00"
define void @usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [74 x i8] c"Usage: ./flow <ip address> [<port>] [--rate <rate>] [--type (good | bad)]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char *escape_wildcards(char *);
char *process_filename(char *filename, unsigned int flags) {
  char *ret = filename;
  if (flags & 1)
    ret = escape_wildcards(ret);
  return ret;
}


x86 assembly (clang, -O0):
<process_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1143 <process_filename+0x33>
mov    -0x18(%rbp),%rdi
call   1030 <escape_wildcards@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_filename>:
test   $0x1,%sil
jne    111a <process_filename+0xa>
mov    %rdi,%rax
ret
jmp    1030 <escape_wildcards@plt>

LLVM IR (-O0):
define i8* @process_filename(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i32, i32* %4
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i8* @escape_wildcards(i8* %11)
store i8* %12, i8** %5
br label %13
13: ; preds = %10, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
define i8* @process_filename(i8* %0, i32 %1) {
%3 = and i32 %1, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i8* @escape_wildcards(i8* %0)
br label %7
7: ; preds = %5, %2
%8 = phi i8* [ %6, %5 ], [ %0, %2 ]
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t s) {
  void *r = malloc(s);
  if (!r)
    do {
      fprintf(stderr, "malloc");
      perror(" ");
      exit(1);
    } while (0);
  return r;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1194 <xmalloc+0x54>
jmp    1169 <xmalloc+0x29>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xe82(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     114d <xmalloc+0xd>
pop    %rcx
ret
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xe9e(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"malloc\00"
@.str.1 = [2 x i8] c" \00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %15, label %8
8: ; preds = %1
br label %9
9: ; preds = %8
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @perror(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; No predecessors!
br label %15
15: ; preds = %14, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"malloc\00"
@.str.1 = [2 x i8] c" \00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @perror(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret i8* %2
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
int datetime_month_days(int, int);
bool datetime_ymd_is_valid(uint16_t year, uint8_t month, uint8_t day) {
  bool status = false;
  uint8_t monthdays = 0;
  monthdays = datetime_month_days(year, month);
  if ((year >= 1900) && (monthdays > 0) && (day >= 1) && (day <= monthdays)) {
    status = true;
  }
  return status;
}


x86 assembly (clang, -O0):
<datetime_ymd_is_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <datetime_month_days@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x76c,-0x4(%rbp)
jl     1171 <datetime_ymd_is_valid+0x61>
cmpl   $0x0,-0x14(%rbp)
jle    1171 <datetime_ymd_is_valid+0x61>
cmpl   $0x1,-0xc(%rbp)
jl     1171 <datetime_ymd_is_valid+0x61>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1171 <datetime_ymd_is_valid+0x61>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<datetime_ymd_is_valid>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %edi,%ebp
call   1030 <datetime_month_days@plt>
cmp    $0x76c,%ebp
setge  %sil
test   %eax,%eax
setg   %dl
test   %ebx,%ebx
setg   %cl
and    %sil,%cl
and    %dl,%cl
cmp    %ebx,%eax
setge  %al
and    %cl,%al
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @datetime_ymd_is_valid(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* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @datetime_month_days(i32 %9, i32 %10)
store i32 %11, i32* %8
%12 = load i32, i32* %4
%13 = icmp sge i32 %12, 1900
br i1 %13, label %14, label %25
14: ; preds = %3
%15 = load i32, i32* %8
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i32, i32* %6
%19 = icmp sge i32 %18, 1
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %6
%22 = load i32, i32* %8
%23 = icmp sle i32 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %7
br label %25
25: ; preds = %24, %20, %17, %14, %3
%26 = load i32, i32* %7
ret i32 %26
}

LLVM IR (-O2):
define i32 @datetime_ymd_is_valid(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @datetime_month_days(i32 %0, i32 %1)
%5 = icmp sgt i32 %0, 1899
%6 = icmp sgt i32 %4, 0
%7 = select i1 %5, i1 %6, i1 false
%8 = icmp sgt i32 %2, 0
%9 = and i1 %8, %7
%10 = icmp sge i32 %4, %2
%11 = select i1 %9, i1 %10, i1 false
%12 = zext i1 %11 to i32
ret i32 %12
}
const char *Zip_Description(void) {
  return "The `Zip` type can be used to combine multiple iterables into one "
         "which "
         "is then iterated over all at once and returned as a Tuple. The Zip "
         "object "
         "only iterates when all of it's sub iterators have valid items. More "
         "specifically the Zip iteration will terminate if _any_ of the sub "
         "iterators terminate.";
}


x86 assembly (clang, -O0):
<Zip_Description>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Zip_Description>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [301 x i8] c"The `Zip` type can be used to combine multiple iterables into one which is then iterated over all at once and returned as a Tuple. The Zip object only iterates when all of it's sub iterators have valid items. More specifically the Zip iteration will terminate if _any_ of the sub iterators terminate.\00"
define i8* @Zip_Description() {
ret i8* getelementptr inbounds ([301 x i8], [301 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [301 x i8] c"The `Zip` type can be used to combine multiple iterables into one which is then iterated over all at once and returned as a Tuple. The Zip object only iterates when all of it's sub iterators have valid items. More specifically the Zip iteration will terminate if _any_ of the sub iterators terminate.\00"
define i8* @Zip_Description() {
ret i8* getelementptr inbounds ([301 x i8], [301 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("Please enter only up to 1 argument.\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [37 x i8] c"Please enter only up to 1 argument.\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"Please enter only up to 1 argument.\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
getn(ap) char *ap;
{
  register int n, c;
  register char *p;
  p = ap;
  n = 0;
  while ((c = *p++) >= '0' && c <= '9')
    n = n * 10 + c - '0';
  return (n);
}


x86 assembly (clang, -O0):
<getn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%ecx
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x19(%rbp)
jl     1144 <getn+0x44>
cmpl   $0x39,-0x10(%rbp)
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1154 <getn+0x54>
jmp    1166 <getn+0x66>
imul   $0xa,-0xc(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <getn+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getn>:
mov    (%rdi),%cl
lea    -0x30(%rcx),%edx
xor    %eax,%eax
cmp    $0x9,%dl
ja     113b <getn+0x3b>
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
lea    -0x30(%rcx),%edx
add    $0x1,%rdi
cmp    $0xa,%dl
jb     1120 <getn+0x20>
ret

LLVM IR (-O0):
define i32 @getn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %5
store i32 0, i32* %3
br label %7
7: ; preds = %18, %1
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %5
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
store i32 %11, i32* %4
%12 = icmp sge i32 %11, 48
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = load i32, i32* %4
%15 = icmp sle i32 %14, 57
br label %16
16: ; preds = %13, %7
%17 = phi i1 [ false, %7 ], [ %15, %13 ]
br i1 %17, label %18, label %24
18: ; preds = %16
%19 = load i32, i32* %3
%20 = mul nsw i32 %19, 10
%21 = load i32, i32* %4
%22 = add nsw i32 %20, %21
%23 = sub nsw i32 %22, 48
store i32 %23, i32* %3
br label %7
24: ; preds = %16
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @getn(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %17
5: ; preds = %1, %5
%6 = phi i8 [ %14, %5 ], [ %2, %1 ]
%7 = phi i8* [ %10, %5 ], [ %0, %1 ]
%8 = phi i32 [ %13, %5 ], [ 0, %1 ]
%9 = zext i8 %6 to i32
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = mul nsw i32 %8, 10
%12 = add i32 %11, -48
%13 = add i32 %12, %9
%14 = load i8, i8* %10
%15 = add i8 %14, -48
%16 = icmp ult i8 %15, 10
br i1 %16, label %5, label %17
17: ; preds = %5, %1
%18 = phi i32 [ 0, %1 ], [ %13, %5 ]
ret i32 %18
}
void brcm_pm_usb_add(void) {}


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

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

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

LLVM IR (-O2):
define void @brcm_pm_usb_add() {
ret void
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strdup(const char *a) {
  char *result = malloc(strlen(a) + 1);
  if (result == NULL)
    return NULL;
  strcpy(result, a);
  return result;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116d <strdup+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1182 <strdup+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <strdup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i8* @malloc(i64 %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %12
11: ; preds = %1
store i8* null, i8** %2
br label %17
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %4
store i8* %16, i8** %2
br label %17
17: ; preds = %12, %11
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %1, %6
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ casesp1(int /*<<< orphan*/);
void casesp(void) { casesp1(0); }


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

x86 assembly (clang, -O2):
<casesp>:
xor    %edi,%edi
jmp    1030 <casesp1@plt>

LLVM IR (-O0):
define void @casesp() {
%1 = call i32 @casesp1(i32 0)
ret void
}

LLVM IR (-O2):
define void @casesp() {
%1 = tail call i32 @casesp1(i32 0)
ret void
}
int is_reg_valid(int i) { return (i > 0 && i <= 16); }


x86 assembly (clang, -O0):
<is_reg_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1120 <is_reg_valid+0x20>
cmpl   $0x10,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_reg_valid>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x10,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @is_reg_valid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 16
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_reg_valid(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 16
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void EMACTxDMAPollDemand(uint32_t ui32Base) {
  (*((volatile uint32_t *)(ui32Base + 0x00000C04))) = 0;
}


x86 assembly (clang, -O0):
<EMACTxDMAPollDemand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,0xc04(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACTxDMAPollDemand>:
movq   $0x0,0xc04(%rdi)
ret

LLVM IR (-O0):
define void @EMACTxDMAPollDemand(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 3076
%5 = inttoptr i64 %4 to i64*
store volatile i64 0, i64* %5
ret void
}

LLVM IR (-O2):
define void @EMACTxDMAPollDemand(i64 %0) {
%2 = add nsw i64 %0, 3076
%3 = inttoptr i64 %2 to i64*
store volatile i64 0, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
int strcmp(char const *, char const *);
void stringShouldEqual(const char expected[], const char actual[]) {
  int result = strcmp(expected, actual);
  if (result == 0)
    return;
  fprintf(stderr, "Expected:\n'%s'\nbut was\n'%s'\n", expected, actual);
  assert(0);
}


x86 assembly (clang, -O0):
<stringShouldEqual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    115f <stringShouldEqual+0x2f>
jmp    1183 <stringShouldEqual+0x53>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe89(%rip),%rsi
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringShouldEqual>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strcmp@plt>
test   %eax,%eax
je     116c <stringShouldEqual+0x3c>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1050 <fprintf@plt>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <assert@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Expected:\0A'%s'\0Abut was\0A'%s'\0A\00"
define void @stringShouldEqual(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @strcmp(i8* %6, i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
br label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %3
%15 = load i8*, i8** %4
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15)
%17 = call i32 @assert(i32 0)
br label %18
18: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Expected:\0A'%s'\0Abut was\0A'%s'\0A\00"
define void @stringShouldEqual(i8* %0, i8* %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%8 = tail call i32 @assert(i32 0)
br label %9
9: ; preds = %2, %5
ret void
}
int test_imm_84uint32_reg(unsigned int val) {
  return ((val) & (0x84 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_84uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x84,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_84uint32_reg>:
test   $0x84,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_84uint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 132
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_84uint32_reg(i32 %0) {
%2 = and i32 %0, 132
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_bit_parity(unsigned int v) {
  int parity = 0;
  while (v) {
    parity ^= (v & 1);
    v >>= 1;
  }
  return parity;
}


x86 assembly (clang, -O0):
<test_bit_parity>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <test_bit_parity+0x32>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <test_bit_parity+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bit_parity>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <test_bit_parity+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
xor    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <test_bit_parity+0x10>
ret

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

LLVM IR (-O2):
define i32 @test_bit_parity(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = xor i32 %4, %6
%8 = lshr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
int numberOfInstalledProblems(void) { return 1; }


x86 assembly (clang, -O0):
<numberOfInstalledProblems>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @numberOfInstalledProblems() {
ret i32 1
}

LLVM IR (-O2):
define i32 @numberOfInstalledProblems() {
ret i32 1
}
int test_imm_16int8_reg(signed char val) {
  return ((val) & (-0x16 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_16int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffea,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_16int8_reg>:
test   $0xea,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_16int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -22
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_16int8_reg(i8 signext %0) {
%2 = and i8 %0, -22
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double sqrt(double);
double x_left(double y) { return -sqrt(1.0 - y * y); }


x86 assembly (clang, -O0):
<x_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_left>:
push   %rax
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xedf(%rip),%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1135 <x_left+0x25>
sqrtsd %xmm0,%xmm0
jmp    113a <x_left+0x2a>
call   1030 <sqrt@plt>
xorpd  0xece(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @x_left(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fneg double %3
%6 = call double @llvm.fmuladd.f64(double %5, double %4, double 1.000000e+00)
%7 = call double @sqrt(double %6)
%8 = fneg double %7
ret double %8
}

LLVM IR (-O2):
define double @x_left(double %0) {
%2 = fneg double %0
%3 = tail call double @llvm.fmuladd.f64(double %2, double %0, double 1.000000e+00)
%4 = tail call double @sqrt(double %3)
%5 = fneg double %4
ret double %5
}
/* Variables and functions */
int callee_flat_u_abs(unsigned int);
unsigned caller_flat_u_na(unsigned bla) { return callee_flat_u_abs(bla); }


x86 assembly (clang, -O0):
<caller_flat_u_na>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <callee_flat_u_abs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caller_flat_u_na>:
jmp    1030 <callee_flat_u_abs@plt>

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

LLVM IR (-O2):
define i32 @caller_flat_u_na(i32 %0) {
%2 = tail call i32 @callee_flat_u_abs(i32 %0)
ret i32 %2
}
extern void *memcpy(void *dest, const void *src, int n) {
  __asm__("cld\n\t"
          "rep\n\t"
          "movsb" ::"c"(n),
          "S"(src), "D"(dest));
  return dest;
}


x86 assembly (clang, -O0):
<memcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdi
cld
rep movsb %ds:(%rsi),%es:(%rdi)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcpy>:
mov    %edx,%ecx
cld
rep movsb %ds:(%rsi),%es:(%rdi)
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @memcpy(i8* returned %0, i8* %1, i32 %2) {
tail call void asm sideeffect "cld\0A\09rep\0A\09movsb", "{cx},{si},{di},~{dirflag},~{fpsr},~{flags}"(i32 %2, i8* %1, i8* %0)
ret i8* %0
}
/* Variables and functions */
size_t SIZE_MAX;
void *reralloc_size(void const *, void *, size_t);
void *reralloc_array_size(const void *ctx, void *ptr, size_t size,
                          unsigned count) {
  if (count > SIZE_MAX / size)
    return NULL;
  return reralloc_size(ctx, ptr, size * count);
}


x86 assembly (clang, -O0):
<reralloc_array_size>:
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    -0x24(%rbp),%eax
mov    %rax,-0x30(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x20(%rbp)
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jbe    115d <reralloc_array_size+0x4d>
movq   $0x0,-0x8(%rbp)
jmp    1179 <reralloc_array_size+0x69>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%eax
imul   %rax,%rdx
call   1030 <reralloc_size@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reralloc_array_size>:
mov    %rdx,%r9
mov    %ecx,%r8d
mov    0x2ebb(%rip),%rax
mov    (%rax),%rax
mov    %rax,%rcx
or     %rdx,%rcx
shr    $0x20,%rcx
je     1139 <reralloc_array_size+0x29>
xor    %edx,%edx
div    %r9
cmp    %r8,%rax
jae    1143 <reralloc_array_size+0x33>
xor    %eax,%eax
ret
xor    %edx,%edx
div    %r9d
cmp    %r8,%rax
jb     1136 <reralloc_array_size+0x26>
imul   %r9,%r8
mov    %r8,%rdx
jmp    1030 <reralloc_size@plt>

LLVM IR (-O0):
@SIZE_MAX = global i64 0
define i8* @reralloc_array_size(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = zext i32 %10 to i64
%12 = load i64, i64* @SIZE_MAX
%13 = load i64, i64* %8
%14 = udiv i64 %12, %13
%15 = icmp ugt i64 %11, %14
br i1 %15, label %16, label %17
16: ; preds = %4
store i8* null, i8** %5
br label %25
17: ; preds = %4
%18 = load i8*, i8** %6
%19 = load i8*, i8** %7
%20 = load i64, i64* %8
%21 = load i32, i32* %9
%22 = zext i32 %21 to i64
%23 = mul i64 %20, %22
%24 = call i8* @reralloc_size(i8* %18, i8* %19, i64 %23)
store i8* %24, i8** %5
br label %25
25: ; preds = %17, %16
%26 = load i8*, i8** %5
ret i8* %26
}

LLVM IR (-O2):
@SIZE_MAX = global i64 0
define i8* @reralloc_array_size(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = zext i32 %3 to i64
%6 = load i64, i64* @SIZE_MAX
%7 = udiv i64 %6, %2
%8 = icmp ult i64 %7, %5
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = mul i64 %5, %2
%11 = tail call i8* @reralloc_size(i8* %0, i8* %1, i64 %10)
br label %12
12: ; preds = %4, %9
%13 = phi i8* [ %11, %9 ], [ null, %4 ]
ret i8* %13
}
/* Variables and functions */
int /*<<< orphan*/ export_gpio(char *);
int /*<<< orphan*/ set_direction(char *);
int /*<<< orphan*/ set_value(char *);
int /*<<< orphan*/ sleep(int);
int main(void) {
  char gpio_number[] = "60";
  export_gpio(gpio_number);
  set_direction("out");
  while (1) {
    sleep(1);
    set_value("1");
    sleep(1);
    set_value("0");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xea2(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x7(%rbp),%rdi
call   1060 <export_gpio@plt>
lea    0xe90(%rip),%rdi
call   1040 <set_direction@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xe7e(%rip),%rdi
call   1030 <set_value@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xe62(%rip),%rdi
call   1030 <set_value@plt>
jmp    1178 <main+0x38>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movb   $0x0,0x6(%rsp)
movw   $0x3036,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1060 <export_gpio@plt>
lea    0xea2(%rip),%rdi
call   1040 <set_direction@plt>
lea    0xe9a(%rip),%r14
lea    0xe8d(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %r14,%rdi
call   1030 <set_value@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <set_value@plt>
jmp    1180 <main+0x40>

LLVM IR (-O0):
@__const.main.gpio_number = [3 x i8] c"60\00"
@.str = [4 x i8] c"out\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
store i32 0, i32* %1
%3 = bitcast [3 x i8]* %2 to i8*
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = call i32 @export_gpio(i8* %4)
%6 = call i32 @set_direction(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %0, %7
%8 = call i32 @sleep(i32 1)
%9 = call i32 @set_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @sleep(i32 1)
%11 = call i32 @set_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %7
}

LLVM IR (-O2):
@__const.main.gpio_number = [3 x i8] c"60\00"
@.str = [4 x i8] c"out\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%3 = call i32 @export_gpio(i8* %2)
%4 = call i32 @set_direction(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %5, %0
%6 = call i32 @sleep(i32 1)
%7 = call i32 @set_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @sleep(i32 1)
%9 = call i32 @set_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %5
}
/* Variables and functions */
scalar_t__ chdir(char *);
int /*<<< orphan*/ fail(char *, char *);
void xchdir(char *dir) {
  if (chdir(dir) < 0)
    fail("cannot change directory to %s", dir);
}


x86 assembly (clang, -O0):
<xchdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <chdir@plt>
cmp    $0x0,%rax
jge    114f <xchdir+0x2f>
mov    -0x8(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1030 <fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xchdir>:
push   %rbx
mov    %rdi,%rbx
call   1040 <chdir@plt>
test   %rax,%rax
js     1130 <xchdir+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <fail@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"cannot change directory to %s\00"
define void @xchdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @chdir(i8* %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @fail(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"cannot change directory to %s\00"
define void @xchdir(i8* %0) {
%2 = tail call i64 @chdir(i8* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fail(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Msp430TimerCapComP__8__Compare__default__fired();
void Msp430TimerCapComP__8__Compare__fired(void) {
  Msp430TimerCapComP__8__Compare__default__fired();
}


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

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

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

LLVM IR (-O2):
define void @Msp430TimerCapComP__8__Compare__fired() {
%1 = tail call i32 (...) @Msp430TimerCapComP__8__Compare__default__fired()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *);
void describe_option(const char *short_option, const char *long_option,
                     const char *description) {
  printf("  -%-14s %s\n", short_option, description);
}


x86 assembly (clang, -O0):
<describe_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<describe_option>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

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