xunge/DecIR huggingface dataset:
/* Variables and functions */
size_t fnmatch_complement_class(const char *class_token) {
  switch (*class_token) {
  case 0:
    return 2;
  case '!':
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<fnmatch_complement_class>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1130 <fnmatch_complement_class+0x30>
jmp    111f <fnmatch_complement_class+0x1f>
mov    -0x14(%rbp),%eax
sub    $0x21,%eax
je     113d <fnmatch_complement_class+0x3d>
jmp    114a <fnmatch_complement_class+0x4a>
movq   $0x2,-0x8(%rbp)
jmp    1152 <fnmatch_complement_class+0x52>
movq   $0x1,-0x8(%rbp)
jmp    1152 <fnmatch_complement_class+0x52>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnmatch_complement_class>:
mov    (%rdi),%al
xor    %ecx,%ecx
cmp    $0x21,%al
sete   %cl
test   %al,%al
mov    $0x2,%eax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
define i64 @fnmatch_complement_class(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %9 [
i32 0, label %7
i32 33, label %8
]
7: ; preds = %1
store i64 2, i64* %2
br label %10
8: ; preds = %1
store i64 1, i64* %2
br label %10
9: ; preds = %1
store i64 0, i64* %2
br label %10
10: ; preds = %9, %8, %7
%11 = load i64, i64* %2
ret i64 %11
}

LLVM IR (-O2):
define i64 @fnmatch_complement_class(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 33
%4 = zext i1 %3 to i64
%5 = icmp eq i8 %2, 0
%6 = select i1 %5, i64 2, i64 %4
ret i64 %6
}
void port_sl_out(unsigned short port, void *buf, unsigned int nr) {
  __asm__("cld;rep;outsl\n\t" ::"d"(port), "S"(buf), "c"(nr));
}


x86 assembly (clang, -O0):
<port_sl_out>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
cld
rep outsl %ds:(%rsi),(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<port_sl_out>:
mov    %edx,%ecx
mov    %edi,%edx
cld
rep outsl %ds:(%rsi),(%dx)
ret

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

LLVM IR (-O2):
define void @port_sl_out(i16 zeroext %0, i8* %1, i32 %2) {
tail call void asm sideeffect "cld;rep;outsl\0A\09", "{dx},{si},{cx},~{dirflag},~{fpsr},~{flags}"(i16 %0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("-v for verbose; -w for very verbose; -f# for number of files (over "
         "16 corrupts stack)\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [87 x i8] c"-v for verbose; -w for very verbose; -f# for number of files (over 16 corrupts stack)\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [86 x i8] c"-v for verbose; -w for very verbose; -f# for number of files (over 16 corrupts stack)\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int wcscmp(int /*<<< orphan*/ const *, int /*<<< orphan*/ const *);
int wcscoll(const wchar_t *ws1, const wchar_t *ws2) { return wcscmp(ws1, ws2); }


x86 assembly (clang, -O0):
<wcscoll>:
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 <wcscmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscoll>:
jmp    1030 <wcscmp@plt>

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

LLVM IR (-O2):
define i32 @wcscoll(i32* %0, i32* %1) {
%3 = tail call i32 @wcscmp(i32* %0, i32* %1)
ret i32 %3
}
/* Type definitions */
struct rusage {
  long ru_maxrss;
};

/* Variables and functions */
int RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int, struct rusage *);
long get_mem_usage() {
  int who = RUSAGE_SELF;
  struct rusage usage;
  struct rusage *p = &usage;
  getrusage(who, p);
  return usage.ru_maxrss;
}


x86 assembly (clang, -O0):
<get_mem_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <getrusage@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mem_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <getrusage@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.rusage = type { i64 }
@RUSAGE_SELF = global i32 0
define i64 @get_mem_usage() {
%1 = alloca i32
%2 = alloca %struct.rusage
%3 = alloca %struct.rusage*
%4 = load i32, i32* @RUSAGE_SELF
store i32 %4, i32* %1
store %struct.rusage* %2, %struct.rusage** %3
%5 = load i32, i32* %1
%6 = load %struct.rusage*, %struct.rusage** %3
%7 = call i32 @getrusage(i32 %5, %struct.rusage* %6)
%8 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i32 0, i32 0
%9 = load i64, i64* %8
ret i64 %9
}

LLVM IR (-O2):
%struct.rusage = type { i64 }
@RUSAGE_SELF = global i32 0
define i64 @get_mem_usage() {
%1 = alloca %struct.rusage
%2 = load i32, i32* @RUSAGE_SELF
%3 = bitcast %struct.rusage* %1 to i8*
%4 = call i32 @getrusage(i32 %2, %struct.rusage* %1)
%5 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}
void initArray(char data[], int size, char value) {
  int i;
  for (i = 0; i < size; i++) {
    data[i] = value;
  }
}


x86 assembly (clang, -O0):
<initArray>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113f <initArray+0x3f>
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <initArray+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initArray>:
test   %esi,%esi
jle    1126 <initArray+0x16>
push   %rax
mov    %esi,%eax
movzbl %dl,%esi
mov    %rax,%rdx
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @initArray(i8* nocapture writeonly %0, i32 %1, i8 signext %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %3
ret void
}
int main() {
  int i;
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
int ptr_cmp(void *ptr1, void *ptr2) { return (char *)ptr1 - (char *)ptr2; }


x86 assembly (clang, -O0):
<ptr_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptr_cmp>:
mov    %rdi,%rax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @ptr_cmp(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 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %6 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ptr_cmp(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_date(char *buf, int len) {
  struct tm *p_tm_time;
  time_t ptime;
  ptime = time(NULL);
  p_tm_time = localtime(&ptime);
  strftime(buf, len, "%Y-%m-%dT%T%z", p_tm_time);
}


x86 assembly (clang, -O0):
<get_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
lea    0xe96(%rip),%rdx
call   1050 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_date>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xeac(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [14 x i8] c"%Y-%m-%dT%T%z\00"
define void @get_date(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.tm*
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = call i32 @time(i32* null)
store i32 %7, i32* %6
%8 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %8, %struct.tm** %5
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = load %struct.tm*, %struct.tm** %5
%12 = call i32 @strftime(i8* %9, i32 %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [14 x i8] c"%Y-%m-%dT%T%z\00"
define void @get_date(i8* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
%7 = call i32 @strftime(i8* %0, i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char const *);
long strtol(char const *, char **, int /*<<< orphan*/);
int parse_int(const char *arg) {
  long ret;
  char *s;
  ret = strtol(arg, &s, 0);
  if (*s != '\0')
    err(1, "parse_count: unexpected character in \"%s\"\n", arg);
  return ret;
}


x86 assembly (clang, -O0):
<parse_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtol@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1164 <parse_int+0x44>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xea1(%rip),%rsi
call   1040 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_int>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <strtol@plt>
mov    %rax,%r14
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     1151 <parse_int+0x31>
lea    0xebc(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
call   1040 <err@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [43 x i8] c"parse_count: unexpected character in \22%s\22\0A\00"
define i32 @parse_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strtol(i8* %5, i8** %4, i32 0)
store i64 %6, i64* %3
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @err(i32 1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %1
%15 = load i64, i64* %3
%16 = trunc i64 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
@.str = [43 x i8] c"parse_count: unexpected character in \22%s\22\0A\00"
define i32 @parse_int(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @strtol(i8* %0, i8** %2, i32 0)
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %8, %1
%11 = trunc i64 %4 to i32
ret i32 %11
}
/* Variables and functions */
int ActiverRelai(int);
int /*<<< orphan*/ printf(char *);
void testActiverRelai() {
  int index;
  int result = ActiverRelai(index);
  if (1) {
    printf("%%TEST_FAILED%% time=0 testname=testActiverRelai "
           "(Test_gestiongpio) message=error message sample\n");
  }
}


x86 assembly (clang, -O0):
<testActiverRelai>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
call   1040 <ActiverRelai@plt>
mov    %eax,-0x8(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testActiverRelai>:
push   %rax
call   1040 <ActiverRelai@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [98 x i8] c"%%TEST_FAILED%% time=0 testname=testActiverRelai (Test_gestiongpio) message=error message sample\0A\00"
define void @testActiverRelai() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
%4 = call i32 @ActiverRelai(i32 %3)
store i32 %4, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [98 x i8] c"%%TEST_FAILED%% time=0 testname=testActiverRelai (Test_gestiongpio) message=error message sample\0A\00"
define void @testActiverRelai() {
%1 = tail call i32 @ActiverRelai(i32 undef)
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0))
ret void
}
float CG_OpFuncMultiply(const float a, const float b) { return a * b; }


x86 assembly (clang, -O0):
<CG_OpFuncMultiply>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_OpFuncMultiply>:
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @CG_OpFuncMultiply(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fmul float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @CG_OpFuncMultiply(float %0, float %1) {
%3 = fmul float %0, %1
ret float %3
}
/* Variables and functions */
long get_next_char_len(char const *);
int /*<<< orphan*/ str_nz_cpy(char *, char const *, long);
const char *get_next_char_str(const char *p) {
  long nextLen;
  static char str[16 + 1];
  nextLen = get_next_char_len(p);
  str_nz_cpy(str, p, nextLen);
  return str;
}


x86 assembly (clang, -O0):
<get_next_char_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_next_char_len@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0x2ef8(%rip),%rdi
call   1040 <str_nz_cpy@plt>
lea    0x2eec(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_char_str>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <get_next_char_len@plt>
lea    0x2f0d(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <str_nz_cpy@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@get_next_char_str.str = internal global [17 x i8] zeroinitializer
define i8* @get_next_char_str(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @get_next_char_len(i8* %4)
store i64 %5, i64* %3
%6 = load i8*, i8** %2
%7 = load i64, i64* %3
%8 = call i32 @str_nz_cpy(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @get_next_char_str.str, i64 0, i64 0), i8* %6, i64 %7)
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @get_next_char_str.str, i64 0, i64 0)
}

LLVM IR (-O2):
@get_next_char_str.str = internal global [17 x i8] zeroinitializer
define i8* @get_next_char_str(i8* %0) {
%2 = tail call i64 @get_next_char_len(i8* %0)
%3 = tail call i32 @str_nz_cpy(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @get_next_char_str.str, i64 0, i64 0), i8* %0, i64 %2)
ret i8* getelementptr inbounds ([17 x i8], [17 x i8]* @get_next_char_str.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printid(int);
int main() {
  int c;
  int mm[2] = {1, 2};
  c = mm[1] > mm[0];
  print("c 1");
  printid(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <print@plt>
mov    -0x8(%rbp),%edi
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <print@plt>
mov    $0x1,%edi
call   1040 <printid@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.mm = [2 x i32] [i32 1, i32 2]
@.str = [4 x i8] c"c 1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
store i32 0, i32* %1
%4 = bitcast [2 x i32]* %3 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%8 = load i32, i32* %7
%9 = icmp sgt i32 %6, %8
%10 = zext i1 %9 to i32
store i32 %10, i32* %2
%11 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = call i32 @printid(i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"c 1\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printid(i32 1)
ret i32 0
}
int op_value(int s) { return ((s + 0x8000) & ~0xffff) / 0x10000; }


x86 assembly (clang, -O0):
<op_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8000,%eax
and    $0xffff0000,%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_value>:
lea    0x8000(%rdi),%ecx
and    $0xffff0000,%ecx
lea    0xffff(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x10,%eax
ret

LLVM IR (-O0):
define i32 @op_value(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 32768
%5 = and i32 %4, -65536
%6 = sdiv i32 %5, 65536
ret i32 %6
}

LLVM IR (-O2):
define i32 @op_value(i32 %0) {
%2 = add nsw i32 %0, 32768
%3 = and i32 %2, -65536
%4 = sdiv i32 %3, 65536
ret i32 %4
}
void flush(volatile void *addr) {
  asm volatile("clflush (%0)\n\t" : : "r"(addr) : "memory");
}


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

x86 assembly (clang, -O2):
<flush>:
clflush (%rdi)
ret

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

LLVM IR (-O2):
define void @flush(i8* %0) {
tail call void asm sideeffect "clflush ($0)\0A\09", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Type definitions */
typedef char *uint64_t;

/* Variables and functions */
uint64_t log2_u64(const uint64_t x) {
  uint64_t y;
  __asm__("\tbsr %1, %0\n" : "=r"(y) : "r"(x) : "cc");
  return y;
}


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

x86 assembly (clang, -O2):
<log2_u64>:
bsr    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @log2_u64(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* asm "\09bsr $1, $0\0A", "=r,r,~{cc},~{dirflag},~{fpsr},~{flags}"(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define i8* @log2_u64(i8* readnone %0) {
%2 = tail call i8* asm "\09bsr $1, $0\0A", "=r,r,~{cc},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void umad_free(void *umad) { free(umad); }


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

x86 assembly (clang, -O2):
<umad_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @umad_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ get_sec(int);
float fget_sec(int flag) { return (float)get_sec(flag); }


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

x86 assembly (clang, -O2):
<fget_sec>:
push   %rax
call   1030 <get_sec@plt>
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fget_sec(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @get_sec(i32 %3)
%5 = sitofp i64 %4 to float
ret float %5
}

LLVM IR (-O2):
define float @fget_sec(i32 %0) {
%2 = tail call i64 @get_sec(i32 %0)
%3 = sitofp i64 %2 to float
ret float %3
}
/* Variables and functions */
int ad_get_sched_table(int, int, int /*<<< orphan*/);
int cmd_get_sched(int dev) { return ad_get_sched_table(1, dev, 0); }


x86 assembly (clang, -O0):
<cmd_get_sched>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
xor    %edx,%edx
call   1030 <ad_get_sched_table@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_get_sched>:
mov    %edi,%esi
mov    $0x1,%edi
xor    %edx,%edx
jmp    1030 <ad_get_sched_table@plt>

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

LLVM IR (-O2):
define i32 @cmd_get_sched(i32 %0) {
%2 = tail call i32 @ad_get_sched_table(i32 1, i32 %0, i32 0)
ret i32 %2
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ fatal(char *, unsigned long);
void *xcalloc(size_t n, size_t size) {
  void *p;
  p = calloc(n, size);
  if (p == NULL)
    fatal("calloc %lu", (unsigned long)size);
  return p;
}


x86 assembly (clang, -O0):
<xcalloc>:
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 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115c <xcalloc+0x3c>
mov    -0x10(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <xcalloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1040 <fatal@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"calloc %lu\00"
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i64, i64* %4
%13 = call i32 @fatal(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %12)
br label %14
14: ; preds = %11, %2
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [11 x i8] c"calloc %lu\00"
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @fatal(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ xip_fpo_unordered_d(int *, double, double);
int xil_fpo_unordered_d(double a, double b) {
  int res_int;
  xip_fpo_unordered_d(&res_int, a, b);
  return res_int;
}


x86 assembly (clang, -O0):
<xil_fpo_unordered_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    -0x14(%rbp),%rdi
call   1030 <xip_fpo_unordered_d@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xil_fpo_unordered_d>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <xip_fpo_unordered_d@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @xil_fpo_unordered_d(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = call i32 @xip_fpo_unordered_d(i32* %5, double %6, double %7)
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @xil_fpo_unordered_d(double %0, double %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @xip_fpo_unordered_d(i32* %3, double %0, double %1)
%6 = load i32, i32* %3
ret i32 %6
}
signed int signedint_ignoring_unsignedshort(signed int x, unsigned short y) {
  return x;
}


x86 assembly (clang, -O0):
<signedint_ignoring_unsignedshort>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signedint_ignoring_unsignedshort>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @signedint_ignoring_unsignedshort(i32 %0, i16 zeroext %1) {
%3 = alloca i32
%4 = alloca i16
store i32 %0, i32* %3
store i16 %1, i16* %4
%5 = load i32, i32* %3
ret i32 %5
}

LLVM IR (-O2):
define i32 @signedint_ignoring_unsignedshort(i32 returned %0, i16 zeroext %1) {
ret i32 %0
}
/* Variables and functions */
scalar_t__ prime(unsigned int);
unsigned howManyPrimes(unsigned lo, unsigned hi) {
  unsigned retVal = 0;
  for (lo; lo < hi; ++lo) {
    if (prime(lo))
      retVal++;
  }
  return retVal;
}


x86 assembly (clang, -O0):
<howManyPrimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    115f <howManyPrimes+0x4f>
mov    -0x4(%rbp),%edi
call   1030 <prime@plt>
cmp    $0x0,%rax
je     114c <howManyPrimes+0x3c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <howManyPrimes+0x41>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1125 <howManyPrimes+0x15>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<howManyPrimes>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
cmp    %esi,%edi
jae    1146 <howManyPrimes+0x36>
mov    %esi,%r14d
mov    %edi,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <prime@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1130 <howManyPrimes+0x20>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @howManyPrimes(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp ult i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i32, i32* %3
%13 = call i64 @prime(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %5
%17 = add i32 %16, 1
store i32 %17, i32* %5
br label %18
18: ; preds = %15, %11
br label %19
19: ; preds = %18
%20 = load i32, i32* %3
%21 = add i32 %20, 1
store i32 %21, i32* %3
br label %7
22: ; preds = %7
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @howManyPrimes(i32 %0, i32 %1) {
%3 = icmp ult i32 %0, %1
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ 0, %2 ]
%6 = phi i32 [ %11, %4 ], [ %0, %2 ]
%7 = tail call i64 @prime(i32 %6)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
%10 = add i32 %5, %9
%11 = add i32 %6, 1
%12 = icmp eq i32 %11, %1
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i32 [ 0, %2 ], [ %10, %4 ]
ret i32 %14
}
int foo(int x) {
  if (x > 0) {
    return 1 + foo(x - 1);
  } else {
    return x;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    113b <foo+0x2b>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <foo@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <foo+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
ret i32 %0
}
int xinc(int dir) {
  switch (dir) {
  case 'b':
  case 'h':
  case 'y':
    return -1;
  case 'l':
  case 'n':
  case 'u':
    return 1;
  case 'j':
  case 'k':
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<xinc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x62,%eax
je     1184 <xinc+0x84>
jmp    111b <xinc+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x68,%eax
je     1184 <xinc+0x84>
jmp    112c <xinc+0x2c>
mov    -0xc(%rbp),%eax
add    $0xffffff96,%eax
sub    $0x2,%eax
jb     119c <xinc+0x9c>
jmp    1140 <xinc+0x40>
mov    -0xc(%rbp),%eax
sub    $0x6c,%eax
je     1190 <xinc+0x90>
jmp    1151 <xinc+0x51>
mov    -0xc(%rbp),%eax
sub    $0x6e,%eax
je     1190 <xinc+0x90>
jmp    1162 <xinc+0x62>
mov    -0xc(%rbp),%eax
sub    $0x75,%eax
je     1190 <xinc+0x90>
jmp    1173 <xinc+0x73>
mov    -0xc(%rbp),%eax
sub    $0x79,%eax
jne    11a1 <xinc+0xa1>
jmp    1184 <xinc+0x84>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a8 <xinc+0xa8>
movl   $0x1,-0x4(%rbp)
jmp    11a8 <xinc+0xa8>
jmp    11a1 <xinc+0xa1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xinc>:
add    $0xffffff9e,%edi
cmp    $0x17,%edi
ja     1128 <xinc+0x28>
mov    $0x81400,%eax
bt     %edi,%eax
jb     1122 <xinc+0x22>
mov    $0xffffffff,%eax
mov    $0x800041,%ecx
bt     %edi,%ecx
jae    1128 <xinc+0x28>
ret
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @xinc(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 98, label %5
i32 104, label %5
i32 121, label %5
i32 108, label %6
i32 110, label %6
i32 117, label %6
i32 106, label %7
i32 107, label %7
]
5: ; preds = %1, %1, %1
store i32 -1, i32* %2
br label %9
6: ; preds = %1, %1, %1
store i32 1, i32* %2
br label %9
7: ; preds = %1, %1
br label %8
8: ; preds = %1, %7
store i32 0, i32* %2
br label %9
9: ; preds = %8, %6, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @xinc(i32 %0) {
switch i32 %0, label %3 [
i32 98, label %4
i32 104, label %4
i32 121, label %4
i32 108, label %2
i32 110, label %2
i32 117, label %2
]
2: ; preds = %1, %1, %1
br label %4
3: ; preds = %1
br label %4
4: ; preds = %1, %1, %1, %3, %2
%5 = phi i32 [ 0, %3 ], [ 1, %2 ], [ -1, %1 ], [ -1, %1 ], [ -1, %1 ]
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ SHUT_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
int x_close(int fd) {
  shutdown(fd, SHUT_RDWR);
  close(fd);
  fd = -1;
  return 0;
}


x86 assembly (clang, -O0):
<x_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_close>:
push   %rbx
mov    %edi,%ebx
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SHUT_RDWR = global i32 0
define i32 @x_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SHUT_RDWR
%5 = call i32 @shutdown(i32 %3, i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @close(i32 %6)
store i32 -1, i32* %2
ret i32 0
}

LLVM IR (-O2):
@SHUT_RDWR = global i32 0
define i32 @x_close(i32 %0) {
%2 = load i32, i32* @SHUT_RDWR
%3 = tail call i32 @shutdown(i32 %0, i32 %2)
%4 = tail call i32 @close(i32 %0)
ret i32 0
}
void openlog(const char *ident, int option, int facility) {}


x86 assembly (clang, -O0):
<openlog>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @openlog(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @openlog(i8* nocapture %0, i32 %1, i32 %2) {
ret void
}
fgtu(unsigned int x, unsigned int y) {
  if (x > y)
    return 13;
  else
    return 140;
}


x86 assembly (clang, -O0):
<fgtu>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jbe    1122 <fgtu+0x22>
movl   $0xd,-0x4(%rbp)
jmp    1129 <fgtu+0x29>
movl   $0x8c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgtu>:
cmp    %esi,%edi
mov    $0xd,%ecx
mov    $0x8c,%eax
cmova  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fgtu(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* %4
%7 = load i32, i32* %5
%8 = icmp ugt i32 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 13, i32* %3
br label %11
10: ; preds = %2
store i32 140, i32* %3
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @fgtu(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 13, i32 140
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void err_exit(char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<err_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<err_exit>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @err_exit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @err_exit(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void flush_msgs() { fflush(stderr); }


x86 assembly (clang, -O0):
<flush_msgs>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_msgs>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @flush_msgs() {
%1 = load i32, i32* @stderr
%2 = call i32 @fflush(i32 %1)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @flush_msgs() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fflush(i32 %1)
ret void
}
int test_imm_48int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x48 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_48int64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x48,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_48int64_highword_mem>:
testb  $0x48,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_48int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 309237645312
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ str_fill_spaces_left(char *, char const *, int);
int /*<<< orphan*/ str_fill_spaces_right(char *, char const *, int);
void str_fill_spaces_both(char *dest, const char *str, int n) {
  str_fill_spaces_left(dest, str, n / 2);
  str_fill_spaces_right(dest, str, n / 2);
}


x86 assembly (clang, -O0):
<str_fill_spaces_both>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1040 <str_fill_spaces_left@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1030 <str_fill_spaces_right@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_fill_spaces_both>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%eax
shr    $0x1f,%eax
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1040 <str_fill_spaces_left@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <str_fill_spaces_right@plt>

LLVM IR (-O0):
define void @str_fill_spaces_both(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 i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = sdiv i32 %9, 2
%11 = call i32 @str_fill_spaces_left(i8* %7, i8* %8, i32 %10)
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = sdiv i32 %14, 2
%16 = call i32 @str_fill_spaces_right(i8* %12, i8* %13, i32 %15)
ret void
}

LLVM IR (-O2):
define void @str_fill_spaces_both(i8* %0, i8* %1, i32 %2) {
%4 = sdiv i32 %2, 2
%5 = tail call i32 @str_fill_spaces_left(i8* %0, i8* %1, i32 %4)
%6 = tail call i32 @str_fill_spaces_right(i8* %0, i8* %1, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ encode_test();
int /*<<< orphan*/ parse_test();
int main(void) {
  parse_test();
  encode_test();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <parse_test@plt>
mov    $0x0,%al
call   1030 <encode_test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <parse_test@plt>
xor    %eax,%eax
call   1030 <encode_test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @parse_test()
%3 = call i32 (...) @encode_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @parse_test()
%2 = tail call i32 (...) @encode_test()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_mem(void *tof) { free(tof); }


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

x86 assembly (clang, -O2):
<free_mem>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_mem(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
char getch();
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ ungets(char *);
int main() {
  char c;
  ungets("hello");
  while ((c = getch()) != 'o')
    putchar(c);
  putchar(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <ungets@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0x6f,%eax
je     116f <main+0x3f>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    114b <main+0x1b>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <ungets@plt>
nopl   (%rax)
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0x6f,%al
je     1155 <main+0x25>
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1140 <main+0x10>
mov    $0x6f,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @ungets(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %8, %0
%5 = call signext i8 (...) @getch()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 111
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i8, i8* %2
%10 = call i32 @putchar(i8 signext %9)
br label %4
11: ; preds = %4
%12 = load i8, i8* %2
%13 = call i32 @putchar(i8 signext %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @ungets(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getch()
%3 = icmp eq i8 %2, 111
br i1 %3, label %9, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %7, %4 ], [ %2, %0 ]
%6 = tail call i32 @putchar(i8 signext %5)
%7 = tail call signext i8 (...) @getch()
%8 = icmp eq i8 %7, 111
br i1 %8, label %9, label %4
9: ; preds = %4, %0
%10 = tail call i32 @putchar(i8 signext 111)
ret i32 0
}
/* Type definitions */
typedef int int64_t;
typedef int int32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int bot_fileutils_fwrite32(int /*<<< orphan*/ *, int);
int bot_fileutils_fwrite64(FILE *f, int64_t v64) {
  int32_t v = v64 >> 32;
  if (0 != bot_fileutils_fwrite32(f, v))
    return -1;
  v = v64 & 0xffffffff;
  return bot_fileutils_fwrite32(f, v);
}


x86 assembly (clang, -O0):
<bot_fileutils_fwrite64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <bot_fileutils_fwrite32@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1150 <bot_fileutils_fwrite64+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    1168 <bot_fileutils_fwrite64+0x58>
mov    -0x14(%rbp),%eax
and    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <bot_fileutils_fwrite32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot_fileutils_fwrite64>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <bot_fileutils_fwrite32@plt>
test   %eax,%eax
je     112d <bot_fileutils_fwrite64+0x1d>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <bot_fileutils_fwrite32@plt>

LLVM IR (-O0):
define i32 @bot_fileutils_fwrite64(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = ashr i32 %7, 32
store i32 %8, i32* %6
%9 = load i32*, i32** %4
%10 = load i32, i32* %6
%11 = call i32 @bot_fileutils_fwrite32(i32* %9, i32 %10)
%12 = icmp ne i32 0, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %20
14: ; preds = %2
%15 = load i32, i32* %5
%16 = and i32 %15, -1
store i32 %16, i32* %6
%17 = load i32*, i32** %4
%18 = load i32, i32* %6
%19 = call i32 @bot_fileutils_fwrite32(i32* %17, i32 %18)
store i32 %19, i32* %3
br label %20
20: ; preds = %14, %13
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @bot_fileutils_fwrite64(i32* %0, i32 %1) {
%3 = tail call i32 @bot_fileutils_fwrite32(i32* %0, i32 poison)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @bot_fileutils_fwrite32(i32* %0, i32 %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ -1, %2 ]
ret i32 %8
}