xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strerror(int /*<<< orphan*/);
int handle_error_file_open(char *path) {
  if (1 == 1)
    printf("Error: Can't Open %s\n", path);
  else if (1 == 2)
    printf("Error: foi possível abrir %s\n", path);
  printf("%s\n\n", (char *)strerror(errno));
  exit(-1);
}


x86 assembly (clang, -O0):
<handle_error_file_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handle_error_file_open>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xec1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Error: Can't Open %s\0A\00"
@.str.1 = [5 x i8] c"%s\0A\0A\00"
@errno = global i32 0
define i32 @handle_error_file_open(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @errno
%6 = call i64 @strerror(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [22 x i8] c"Error: Can't Open %s\0A\00"
@.str.1 = [5 x i8] c"%s\0A\0A\00"
@errno = global i32 0
define i32 @handle_error_file_open(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @errno
%4 = tail call i64 @strerror(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
struct tm *gmtime_r(const time_t *timep, struct tm *result) {
  ;
  memset(result, 0, sizeof(struct tm));
  return result;
}


x86 assembly (clang, -O0):
<gmtime_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmtime_r>:
push   %rbx
mov    %rsi,%rbx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.tm = type { i32 }
define %struct.tm* @gmtime_r(i32* nocapture readnone %0, %struct.tm* returned %1) {
%3 = tail call i32 @memset(%struct.tm* %1, i32 0, i32 4)
ret %struct.tm* %1
}
/* Variables and functions */
int bs_get_info(int, char *, char **);
int /*<<< orphan*/ snprintf(char *, int, char *);
int bs_list_tubes(int fd, char **yaml) {
  char command[64];
  snprintf(command, 64, "list-tubes\r\n");
  return bs_get_info(fd, command, yaml);
}


x86 assembly (clang, -O0):
<bs_list_tubes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x40,%esi
lea    0xec1(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <bs_get_info@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bs_list_tubes>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xecc(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x40,%esi
call   1040 <snprintf@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <bs_get_info@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"list-tubes\0D\0A\00"
define i32 @bs_list_tubes(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [64 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = call i32 @snprintf(i8* %6, i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%10 = load i8**, i8*** %4
%11 = call i32 @bs_get_info(i32 %8, i8* %9, i8** %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [13 x i8] c"list-tubes\0D\0A\00"
define i32 @bs_list_tubes(i32 %0, i8** %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @bs_get_info(i32 %0, i8* %4, i8** %1)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ _scanf_getl(char *, int *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ safe_gets(char *, int);
unsigned gethex() {
  char buf[80];
  safe_gets(buf, 80);
  unsigned x = 0;
  _scanf_getl(buf, (int *)&x, 16, 80, 0);
  return x;
}


x86 assembly (clang, -O0):
<gethex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
mov    $0x50,%esi
call   1040 <safe_gets@plt>
movl   $0x0,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0x54(%rbp),%rsi
mov    $0x10,%edx
mov    $0x50,%ecx
xor    %r8d,%r8d
call   1030 <_scanf_getl@plt>
mov    -0x54(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gethex>:
push   %rbx
sub    $0x60,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1040 <safe_gets@plt>
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
mov    $0x50,%ecx
xor    %r8d,%r8d
call   1030 <_scanf_getl@plt>
mov    0xc(%rsp),%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @gethex() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = call i32 @safe_gets(i8* %3, i32 80)
store i32 0, i32* %2
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%6 = call i32 @_scanf_getl(i8* %5, i32* %2, i32 16, i32 80, i32 0)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @gethex() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = call i32 @safe_gets(i8* %3, i32 80)
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = call i32 @_scanf_getl(i8* %3, i32* %2, i32 16, i32 80, i32 0)
%7 = load i32, i32* %2
ret i32 %7
}
/* Type definitions */
struct sigaction {
  int /*<<< orphan*/ sa_handler;
};
typedef int /*<<< orphan*/ act;

/* Variables and functions */
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ memset(struct sigaction *, int /*<<< orphan*/, int);
int sigaction(int, struct sigaction *, int /*<<< orphan*/ *);
int sigignore(int sig) {
  struct sigaction act;
  memset(&act, 0, sizeof(act));
  act.sa_handler = SIG_IGN;
  return sigaction(sig, &act, NULL);
}


x86 assembly (clang, -O0):
<sigignore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigignore>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sigaction = type { i32 }
@SIG_IGN = global i32 0
define i32 @sigignore(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sigaction
store i32 %0, i32* %2
%4 = call i32 @memset(%struct.sigaction* %3, i32 0, i32 4)
%5 = load i32, i32* @SIG_IGN
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = call i32 @sigaction(i32 %7, %struct.sigaction* %3, i32* null)
ret i32 %8
}

LLVM IR (-O2):
%struct.sigaction = type { i32 }
@SIG_IGN = global i32 0
define i32 @sigignore(i32 %0) {
%2 = alloca %struct.sigaction
%3 = bitcast %struct.sigaction* %2 to i8*
%4 = call i32 @memset(%struct.sigaction* %2, i32 0, i32 4)
%5 = load i32, i32* @SIG_IGN
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 0
store i32 %5, i32* %6
%7 = call i32 @sigaction(i32 %0, %struct.sigaction* %2, i32* null)
ret i32 %7
}
void yy_1_ThrowShouldNotBeHereException(char *yytext, int yyleng) {
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @yy_1_ThrowShouldNotBeHereException(i8* nocapture %0, i32 %1) {
ret void
}
void function(void) {}


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

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

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

LLVM IR (-O2):
define void @function() {
ret void
}
void lll_prof_exit_ull_low(void) {}


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

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

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

LLVM IR (-O2):
define void @lll_prof_exit_ull_low() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sigint_handler(int signo) { printf("In SIGINT handler ...\n"); }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"In SIGINT handler ...\0A\00"
define void @sigint_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"In SIGINT handler ...\00"
define void @sigint_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret void
}
void ShowEtherdevStats(void) {}


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

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

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

LLVM IR (-O2):
define void @ShowEtherdevStats() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int prompt(char *msg, char *result) {
  printf("\n%s?", msg);
  fgets(result, 100, stdin);
  result[strlen(result) - 1] = '\0';
  return (strlen(result));
}


x86 assembly (clang, -O0):
<prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e8d(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1050 <fgets@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strlen@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\0A%s?\00"
@stdin = global i32 0
define i32 @prompt(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 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %4
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 100, i32 %8)
%10 = load i8*, i8** %4
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %10, i64 %14
store i8 0, i8* %15
%16 = load i8*, i8** %4
%17 = call i32 @strlen(i8* %16)
ret i32 %17
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0A%s?\00"
@stdin = global i32 0
define i32 @prompt(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stdin
%5 = tail call i32 @fgets(i8* %1, i32 100, i32 %4)
%6 = tail call i32 @strlen(i8* %1)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 0, i8* %9
%10 = tail call i32 @strlen(i8* %1)
ret i32 %10
}
float antideadzone(float value, float antideadzone, float k) {
  float f = 1.0f / 65535.0f;
  if (value > f) {
    value = value * k + antideadzone;
  } else if (value < -f) {
    value = value * k - antideadzone;
  }
  return value;
}


x86 assembly (clang, -O0):
<antideadzone>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  0xee5(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1150 <antideadzone+0x50>
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    119e <antideadzone+0x9e>
movss  -0x4(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
ucomiss %xmm1,%xmm0
jbe    1199 <antideadzone+0x99>
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    119e <antideadzone+0x9e>
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<antideadzone>:
ucomiss 0xef9(%rip),%xmm0
jbe    1112 <antideadzone+0x12>
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
ret
movss  0xeea(%rip),%xmm3
ucomiss %xmm0,%xmm3
jbe    1127 <antideadzone+0x27>
mulss  %xmm2,%xmm0
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @antideadzone(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
store float 0x3EF0001000000000, float* %7
%8 = load float, float* %4
%9 = load float, float* %7
%10 = fcmp ogt float %8, %9
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load float, float* %4
%13 = load float, float* %6
%14 = load float, float* %5
%15 = call float @llvm.fmuladd.f32(float %12, float %13, float %14)
store float %15, float* %4
br label %28
16: ; preds = %3
%17 = load float, float* %4
%18 = load float, float* %7
%19 = fneg float %18
%20 = fcmp olt float %17, %19
br i1 %20, label %21, label %27
21: ; preds = %16
%22 = load float, float* %4
%23 = load float, float* %6
%24 = load float, float* %5
%25 = fneg float %24
%26 = call float @llvm.fmuladd.f32(float %22, float %23, float %25)
store float %26, float* %4
br label %27
27: ; preds = %21, %16
br label %28
28: ; preds = %27, %11
%29 = load float, float* %4
ret float %29
}

LLVM IR (-O2):
define float @antideadzone(float %0, float %1, float %2) {
%4 = fcmp ogt float %0, 0x3EF0001000000000
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %1)
br label %12
7: ; preds = %3
%8 = fcmp olt float %0, 0xBEF0001000000000
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = fneg float %1
%11 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %10)
br label %12
12: ; preds = %7, %9, %5
%13 = phi float [ %6, %5 ], [ %11, %9 ], [ %0, %7 ]
ret float %13
}
/* Type definitions */
struct sd_cpu {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ht_free(struct sd_cpu *);
void sd_cpu_free(struct sd_cpu *cpu) { ht_free(cpu); }


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

x86 assembly (clang, -O2):
<sd_cpu_free>:
jmp    1030 <ht_free@plt>

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

LLVM IR (-O2):
%struct.sd_cpu = type { i32 }
define void @sd_cpu_free(%struct.sd_cpu* %0) {
%2 = tail call i32 @ht_free(%struct.sd_cpu* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void visualize(unsigned int x) {
  int i;
  for (;;) {
    if (1)
      printf("1");
    else
      printf("0");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<visualize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
jmp    111b <visualize+0xb>

x86 assembly (clang, -O2):
<visualize>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x31,%edi
call   1030 <putchar@plt>
jmp    1120 <visualize+0x10>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
define void @visualize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %4, %1
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %4
}

LLVM IR (-O2):
define void @visualize(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @putchar(i32 49)
br label %2
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
#define TIME_UTC 128
int timespec_get(struct timespec *ts, int base) {
  switch (base) {
  case TIME_UTC:
    return 0;
  default:
    return 0;
  }
  return base;
}


x86 assembly (clang, -O0):
<timespec_get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
jne    112a <timespec_get+0x2a>
jmp    111e <timespec_get+0x1e>
movl   $0x0,-0x4(%rbp)
jmp    1131 <timespec_get+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec_get>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @timespec_get(%struct.timespec* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
%5 = alloca i32
store %struct.timespec* %0, %struct.timespec** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %8 [
i32 128, label %7
]
7: ; preds = %2
store i32 0, i32* %3
br label %9
8: ; preds = %2
store i32 0, i32* %3
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @timespec_get(%struct.timespec* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xe0() {
  Assert_real((isalpha(224) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              1125, ("isalpha should be 0 for 0xe0"));
}


x86 assembly (clang, -O0):
<t_isalpha_0xe0>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0,%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x465,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0xe0>:
push   %rax
mov    $0xe0,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x465,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xe0\00"
define void @t_isalpha_0xe0() {
%1 = call i64 @isalpha(i32 224)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1125, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xe0\00"
define void @t_isalpha_0xe0() {
%1 = tail call i64 @isalpha(i32 224)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1125, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned int fn_calc_memory_crc32(void *, unsigned int);
unsigned int fn_check_memory_crc32(void *p, unsigned int n_bytes,
                                   unsigned int crc) {
  return (fn_calc_memory_crc32(p, n_bytes) == crc);
}


x86 assembly (clang, -O0):
<fn_check_memory_crc32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <fn_calc_memory_crc32@plt>
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_check_memory_crc32>:
push   %rbx
mov    %edx,%ebx
call   1030 <fn_calc_memory_crc32@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fn_check_memory_crc32(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
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = call i32 @fn_calc_memory_crc32(i8* %7, i32 %8)
%10 = load i32, i32* %6
%11 = icmp eq i32 %9, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @fn_check_memory_crc32(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @fn_calc_memory_crc32(i8* %0, i32 %1)
%5 = icmp eq i32 %4, %2
%6 = zext i1 %5 to i32
ret i32 %6
}
int fcomp(float *p1, float *p2) { return ((*p1 < *p2) ? -1 : (*p1 > *p2)); }


x86 assembly (clang, -O0):
<fcomp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    1132 <fcomp+0x32>
mov    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <fcomp+0x4c>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomiss (%rax),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcomp>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
seta   %cl
ucomiss %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fcomp(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* %5
%7 = load float*, float** %4
%8 = load float, float* %7
%9 = fcmp olt float %6, %8
br i1 %9, label %10, label %11
10: ; preds = %2
br label %18
11: ; preds = %2
%12 = load float*, float** %3
%13 = load float, float* %12
%14 = load float*, float** %4
%15 = load float, float* %14
%16 = fcmp ogt float %13, %15
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %11, %10
%19 = phi i32 [ -1, %10 ], [ %17, %11 ]
ret i32 %19
}

LLVM IR (-O2):
define i32 @fcomp(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fcmp olt float %3, %4
%6 = fcmp ogt float %3, %4
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
int test_int(char *ptr) { return ++*((unsigned int *)ptr); }


x86 assembly (clang, -O0):
<test_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%eax
add    $0x1,%eax
mov    %eax,(%rcx)
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_int(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = add i32 %5, 1
store i32 %6, i32* %4
ret i32 %6
}

LLVM IR (-O2):
define i32 @test_int(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = add i32 %3, 1
store i32 %4, i32* %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ bottom_func();
void middle_func(void) { bottom_func(); }


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

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

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

LLVM IR (-O2):
define void @middle_func() {
%1 = tail call i32 (...) @bottom_func()
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int validEvent(const char *event) {
  if ((0 == strcmp(event, "Load")) || (0 == strcmp(event, "Unload"))) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<validEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1158 <validEvent+0x48>
mov    -0x10(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1164 <validEvent+0x54>
movl   $0x1,-0x4(%rbp)
jmp    116b <validEvent+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validEvent>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1141 <validEvent+0x31>
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"Load\00"
@.str.1 = [7 x i8] c"Unload\00"
define i32 @validEvent(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
void fprint_orl_data_to_direct(FILE *stream, uint8_t direct, uint8_t data) {
  fprintf(stream,
          "ORL   "
          "0x%02X"
          ", #"
          "0x%02X"
          "               ",
          direct, data);
}


x86 assembly (clang, -O0):
<fprint_orl_data_to_direct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_orl_data_to_direct>:
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee5(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"ORL 0x%02X,x%02X \00"
define void @fprint_orl_data_to_direct(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"ORL 0x%02X,x%02X \00"
define void @fprint_orl_data_to_direct(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}
int get_gpio_index(int gpio) { return gpio & 0x1f; }


x86 assembly (clang, -O0):
<get_gpio_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_gpio_index>:
mov    %edi,%eax
and    $0x1f,%eax
ret

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

LLVM IR (-O2):
define i32 @get_gpio_index(i32 %0) {
%2 = and i32 %0, 31
ret i32 %2
}
int from_stdin(void) {
  int *IO = (void *)(0x3c000000 + 2 * 0x00000020);
  return (*IO);
}


x86 assembly (clang, -O0):
<from_stdin>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3c000040,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<from_stdin>:
mov    0x3c000040,%eax
ret

LLVM IR (-O0):
define i32 @from_stdin() {
%1 = alloca i32*
store i32* inttoptr (i64 1006633024 to i32*), i32** %1
%2 = load i32*, i32** %1
%3 = load i32, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @from_stdin() {
%1 = load i32, i32* inttoptr (i64 1006633024 to i32*)
ret i32 %1
}
int Remove_Shmem(unit, type)
int unit;
int type;
{ return Detach_Shmem(unit, 0, type); }


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

x86 assembly (clang, -O2):
<Remove_Shmem>:
mov    %esi,%edx
xor    %esi,%esi
xor    %eax,%eax
jmp    1030 <Detach_Shmem@plt>

LLVM IR (-O0):
define i32 @Remove_Shmem(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 (i32, i32, i32, ...) bitcast (i32 (...)* @Detach_Shmem to i32 (i32, i32, i32, ...)*)(i32 %5, i32 0, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @Remove_Shmem(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @Detach_Shmem to i32 (i32, i32, i32, ...)*)(i32 %0, i32 0, i32 %1)
ret i32 %3
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int string_ge(char *s1, char *s2, int k) {
  k = 0;
  return strcmp(s1, s2) >= 0;
}


x86 assembly (clang, -O0):
<string_ge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_ge>:
push   %rax
call   1030 <strcmp@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @string_ge(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
store i32 0, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i64 @strcmp(i8* %7, i8* %8)
%10 = icmp sge i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @string_ge(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* %1)
%5 = lshr i64 %4, 63
%6 = trunc i64 %5 to i32
%7 = xor i32 %6, 1
ret i32 %7
}
int test_imm_43int8_mem(signed char *val) {
  return ((*val) & (0x43 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_43int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0x43,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_43int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 67
%7 = icmp ne i32 %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_43int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 67
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ calculate_pi_1(int);
int /*<<< orphan*/ calculate_pi_2(int);
int /*<<< orphan*/ start();
int /*<<< orphan*/ stop();
int main() {
  start();
  calculate_pi_1(10000);
  calculate_pi_2(100000);
  stop();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <start@plt>
mov    $0x2710,%edi
call   1060 <calculate_pi_1@plt>
mov    $0x186a0,%edi
call   1040 <calculate_pi_2@plt>
mov    $0x0,%al
call   1030 <stop@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <start@plt>
mov    $0x2710,%edi
call   1060 <calculate_pi_1@plt>
mov    $0x186a0,%edi
call   1040 <calculate_pi_2@plt>
xor    %eax,%eax
call   1030 <stop@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @start()
%3 = call i32 @calculate_pi_1(i32 10000)
%4 = call i32 @calculate_pi_2(i32 100000)
%5 = call i32 (...) @stop()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @start()
%2 = tail call i32 @calculate_pi_1(i32 10000)
%3 = tail call i32 @calculate_pi_2(i32 100000)
%4 = tail call i32 (...) @stop()
ret i32 0
}
/* Variables and functions */
int __sync_fetch_and_min(int volatile *, int);
void test14() {
  int old;
  old = __sync_fetch_and_min((volatile int *)&old, 1);
}


x86 assembly (clang, -O0):
<test14>:
push   %rbp
mov    %rsp,%rbp
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
sub    $0x2,%ecx
mov    %ecx,-0x10(%rbp)
mov    $0x1,%ecx
cmovl  %eax,%ecx
lock cmpxchg %ecx,-0x4(%rbp)
sete   %cl
mov    %eax,-0xc(%rbp)
test   $0x1,%cl
mov    %eax,-0x8(%rbp)
jne    1139 <test14+0x39>
jmp    110a <test14+0xa>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test14>:
mov    -0x4(%rsp),%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x2,%eax
mov    $0x1,%ecx
cmovl  %eax,%ecx
lock cmpxchg %ecx,-0x4(%rsp)
jne    1110 <test14+0x10>
ret

LLVM IR (-O0):
define void @test14() {
%1 = alloca i32
%2 = atomicrmw min i32* %1, i32 1 seq_cst
store i32 %2, i32* %1
ret void
}

LLVM IR (-O2):
define void @test14() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = atomicrmw min i32* %1, i32 1 seq_cst
ret void
}
int bitcount(int x) {
  int b;
  for (b = 0; x != 0; x >>= 1)
    if (x & 01)
      b++;
  return b;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1143 <bitcount+0x43>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1130 <bitcount+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <bitcount+0x35>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <bitcount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bitcount(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 = add nuw nsw i32 %4, %6
%8 = ashr 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
}
/* Variables and functions */
size_t write_dword(char *ptr, unsigned int value) {
  ;
  *(int *)ptr = value;
  return sizeof(int);
}


x86 assembly (clang, -O0):
<write_dword>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_dword>:
mov    %esi,(%rdi)
mov    $0x4,%eax
ret

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

LLVM IR (-O2):
define i64 @write_dword(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret i64 4
}
/* Variables and functions */
int /*<<< orphan*/ RedrawPlayfield_EM(int /*<<< orphan*/);
void game_animscreen(void) { RedrawPlayfield_EM(0); }


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

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

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

LLVM IR (-O2):
define void @game_animscreen() {
%1 = tail call i32 @RedrawPlayfield_EM(i32 0)
ret void
}
__attribute__((gnu_)) __attribute__((always_)) int func5b(int x) {
  return x < 12 ? 1 : 2;
}


x86 assembly (clang, -O0):
<func5b>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x2,%eax
mov    $0x1,%ecx
cmp    $0xc,%edx
cmovl  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func5b>:
xor    %ecx,%ecx
cmp    $0xc,%edi
setl   %cl
mov    $0x2,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @func5b(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 12
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 2
ret i32 %6
}

LLVM IR (-O2):
define i32 @func5b(i32 %0) {
%2 = icmp slt i32 %0, 12
%3 = select i1 %2, i32 1, i32 2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main() {
  setuid(0);
  system("/bin/chmod -R a+r /tmp/box/");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"/bin/chmod -R a+r /tmp/box/\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @setuid(i32 0)
%3 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"/bin/chmod -R a+r /tmp/box/\00"
define i32 @main() {
%1 = tail call i32 @setuid(i32 0)
%2 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
char *strchr(char const *, int);
int strlen(char const *);
char *strchrnul(const char *s, int c) {
  char *p = strchr(s, c);
  return p ? p : (char *)s + strlen(s);
}


x86 assembly (clang, -O0):
<strchrnul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1157 <strchrnul+0x37>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1178 <strchrnul+0x58>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchrnul>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strchr@plt>
test   %rax,%rax
je     1130 <strchrnul+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @strchrnul(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
%7 = load i32, i32* %4
%8 = call i8* @strchr(i8* %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i8*, i8** %5
br label %19
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = load i8*, i8** %3
%16 = call i32 @strlen(i8* %15)
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
br label %19
19: ; preds = %13, %11
%20 = phi i8* [ %12, %11 ], [ %18, %13 ]
ret i8* %20
}

LLVM IR (-O2):
define i8* @strchrnul(i8* %0, i32 %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %0)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
br label %9
9: ; preds = %2, %5
%10 = phi i8* [ %8, %5 ], [ %3, %2 ]
ret i8* %10
}
int convert_bit_range(int c, int from_bits, int to_bits) {
  int b = (1 << (from_bits - 1)) + c * ((1 << to_bits) - 1);
  return (b + (b >> from_bits)) >> from_bits;
}


x86 assembly (clang, -O0):
<convert_bit_range>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    -0x4(%rbp),%ecx
mov    %ecx,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x14(%rbp),%ecx
sub    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_bit_range>:
mov    %edx,%r8d
lea    -0x1(%rsi),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    $0xffffffff,%edx
mov    %r8d,%ecx
shl    %cl,%edx
not    %edx
imul   %edi,%edx
add    %eax,%edx
mov    %edx,%eax
mov    %esi,%ecx
sar    %cl,%eax
add    %edx,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @convert_bit_range(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = sub nsw i32 %8, 1
%10 = shl i32 1, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = shl i32 1, %12
%14 = sub nsw i32 %13, 1
%15 = mul nsw i32 %11, %14
%16 = add nsw i32 %10, %15
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = load i32, i32* %7
%19 = load i32, i32* %5
%20 = ashr i32 %18, %19
%21 = add nsw i32 %17, %20
%22 = load i32, i32* %5
%23 = ashr i32 %21, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @convert_bit_range(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -1
%5 = shl nuw i32 1, %4
%6 = shl nsw i32 -1, %2
%7 = xor i32 %6, -1
%8 = mul nsw i32 %7, %0
%9 = add nsw i32 %8, %5
%10 = ashr i32 %9, %1
%11 = add nsw i32 %10, %9
%12 = ashr i32 %11, %1
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int pthread_sigmask(int, int /*<<< orphan*/ const *, int /*<<< orphan*/ *);
int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) {
  return pthread_sigmask(how, set, oldset);
}


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

x86 assembly (clang, -O2):
<sigprocmask>:
jmp    1030 <pthread_sigmask@plt>

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

LLVM IR (-O2):
define i32 @sigprocmask(i32 %0, i32* %1, i32* %2) {
%4 = tail call i32 @pthread_sigmask(i32 %0, i32* %1, i32* %2)
ret i32 %4
}
int cbuf2buf() {}


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

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

LLVM IR (-O0):
define i32 @cbuf2buf() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @cbuf2buf() {
ret i32 undef
}