xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ GETVAL;
int semctl(int, int, int /*<<< orphan*/, int /*<<< orphan*/);
int get_val_sem_member(int semid, int member) {
  int semval;
  semval = semctl(semid, member, GETVAL, 0);
  return semval;
}


x86 assembly (clang, -O0):
<get_val_sem_member>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1030 <semctl@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_val_sem_member>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
jmp    1030 <semctl@plt>

LLVM IR (-O0):
@GETVAL = global i32 0
define i32 @get_val_sem_member(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = load i32, i32* @GETVAL
%9 = call i32 @semctl(i32 %6, i32 %7, i32 %8, i32 0)
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
@GETVAL = global i32 0
define i32 @get_val_sem_member(i32 %0, i32 %1) {
%3 = load i32, i32* @GETVAL
%4 = tail call i32 @semctl(i32 %0, i32 %1, i32 %3, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ foo(char *);
int /*<<< orphan*/ foo2(char *);
void foo3() {
  char buf[20];
  buf[0] = '\0';
  foo(buf);
  foo2(buf);
}


x86 assembly (clang, -O0):
<foo3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movb   $0x0,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <foo@plt>
lea    -0x20(%rbp),%rdi
call   1030 <foo2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo3>:
push   %rbx
sub    $0x20,%rsp
movb   $0x0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <foo@plt>
mov    %rbx,%rdi
call   1030 <foo2@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @foo3() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
store i8 0, i8* %2
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @foo(i8* %3)
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = call i32 @foo2(i8* %5)
ret void
}

LLVM IR (-O2):
define void @foo3() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
store i8 0, i8* %2
%3 = call i32 @foo(i8* %2)
%4 = call i32 @foo2(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void print_version(void) {
  printf("Version : %s\n", "1.0.0");
  exit(EXIT_SUCCESS);
}


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

x86 assembly (clang, -O2):
<print_version>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1030 <printf@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Version : %s\0A\00"
@.str.1 = [6 x i8] c"1.0.0\00"
@EXIT_SUCCESS = global i32 0
define void @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"Version : %s\0A\00"
@.str.1 = [6 x i8] c"1.0.0\00"
@EXIT_SUCCESS = global i32 0
define void @print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
char *strrchr(char const *const, char);
char *get_filename_ext(const char *const filename) {
  char *p;
  p = strrchr(filename, '.');
  if (p)
    ++p;
  return p;
}


x86 assembly (clang, -O0):
<get_filename_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1145 <get_filename_ext+0x35>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_filename_ext>:
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @get_filename_ext(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 46)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @get_filename_ext(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* null, i8* %4
ret i8* %5
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t;
struct exchange {
  int dummy;
};

/* Variables and functions */
int zero_test(int /*<<< orphan*/ *, int);
int isakmp_validate_id_information(u_int8_t type, u_int8_t *extra,
                                   u_int8_t *buf, size_t sz,
                                   struct exchange *exchange) {
  return zero_test(extra, 3);
}


x86 assembly (clang, -O0):
<isakmp_validate_id_information>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1030 <zero_test@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isakmp_validate_id_information>:
mov    %rsi,%rdi
mov    $0x3,%esi
jmp    1030 <zero_test@plt>

LLVM IR (-O0):
%struct.exchange = type { i32 }
define i32 @isakmp_validate_id_information(i32 %0, i32* %1, i32* %2, i64 %3, %struct.exchange* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i64
%10 = alloca %struct.exchange*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i64 %3, i64* %9
store %struct.exchange* %4, %struct.exchange** %10
%11 = load i32*, i32** %7
%12 = call i32 @zero_test(i32* %11, i32 3)
ret i32 %12
}

LLVM IR (-O2):
%struct.exchange = type { i32 }
define i32 @isakmp_validate_id_information(i32 %0, i32* %1, i32* nocapture readnone %2, i64 %3, %struct.exchange* nocapture readnone %4) {
%6 = tail call i32 @zero_test(i32* %1, i32 3)
ret i32 %6
}
/* Variables and functions */
int chdir(char *);
extern int os_daemon(int debug) { return chdir("/"); }


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

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

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
define i32 @os_daemon(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
define i32 @os_daemon(i32 %0) {
%2 = tail call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
float music_sheet_get_time_length(struct music_sheet *self) { return 0.0f; }


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

x86 assembly (clang, -O2):
<music_sheet_get_time_length>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
%struct.music_sheet = type opaque
define float @music_sheet_get_time_length(%struct.music_sheet* %0) {
%2 = alloca %struct.music_sheet*
store %struct.music_sheet* %0, %struct.music_sheet** %2
ret float 0.000000e+00
}

LLVM IR (-O2):
%struct.music_sheet = type opaque
define float @music_sheet_get_time_length(%struct.music_sheet* nocapture readnone %0) {
ret float 0.000000e+00
}
double above_wrapper(double *arg_list) { return (arg_list[0] > arg_list[1]); }


x86 assembly (clang, -O0):
<above_wrapper>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<above_wrapper>:
movsd  0x8(%rdi),%xmm1
cmpltsd (%rdi),%xmm1
movsd  0xeee(%rip),%xmm0
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @above_wrapper(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = fcmp ogt double %5, %8
%10 = zext i1 %9 to i32
%11 = sitofp i32 %10 to double
ret double %11
}

LLVM IR (-O2):
define double @above_wrapper(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fcmp ogt double %2, %4
%6 = uitofp i1 %5 to double
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ parallel_clr_nrfd(int);
int /*<<< orphan*/ parallel_set_nrfd(int);
void parallel_cpu_set_nrfd(unsigned char val) {
  if (val) {
    parallel_set_nrfd(0x02);
  } else {
    parallel_clr_nrfd(~0x02);
  }
}


x86 assembly (clang, -O0):
<parallel_cpu_set_nrfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     1147 <parallel_cpu_set_nrfd+0x27>
mov    $0x2,%edi
call   1040 <parallel_set_nrfd@plt>
jmp    1151 <parallel_cpu_set_nrfd+0x31>
mov    $0xfffffffd,%edi
call   1030 <parallel_clr_nrfd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parallel_cpu_set_nrfd>:
test   %edi,%edi
je     112e <parallel_cpu_set_nrfd+0xe>
mov    $0x2,%edi
jmp    1040 <parallel_set_nrfd@plt>
mov    $0xfffffffd,%edi
jmp    1030 <parallel_clr_nrfd@plt>

LLVM IR (-O0):
define void @parallel_cpu_set_nrfd(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = icmp ne i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @parallel_set_nrfd(i32 2)
br label %9
7: ; preds = %1
%8 = call i32 @parallel_clr_nrfd(i32 -3)
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @parallel_cpu_set_nrfd(i8 zeroext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @parallel_set_nrfd(i32 2)
br label %7
5: ; preds = %1
%6 = tail call i32 @parallel_clr_nrfd(i32 -3)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int isMUL(const char *comm) { return strcmp(comm, "mul") == 0; }


x86 assembly (clang, -O0):
<isMUL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isMUL>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"mul\00"
define i32 @isMUL(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [4 x i8] c"mul\00"
define i32 @isMUL(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void handler_quit(int signum) { printf("this is quit\n"); }


x86 assembly (clang, -O0):
<handler_quit>:
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):
<handler_quit>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"this is quit\0A\00"
define void @handler_quit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"this is quit\00"
define void @handler_quit(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *);
int /*<<< orphan*/ output_byte(int);
void emit_fchs() {
  assem_debug("fchs\n");
  output_byte(0xd9);
  output_byte(0xe0);
}


x86 assembly (clang, -O0):
<emit_fchs>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xd9,%edi
call   1040 <output_byte@plt>
mov    $0xe0,%edi
call   1040 <output_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fchs>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xd9,%edi
call   1040 <output_byte@plt>
mov    $0xe0,%edi
pop    %rax
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"fchs\0A\00"
define void @emit_fchs() {
%1 = call i32 @assem_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @output_byte(i32 217)
%3 = call i32 @output_byte(i32 224)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"fchs\0A\00"
define void @emit_fchs() {
%1 = tail call i32 @assem_debug(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @output_byte(i32 217)
%3 = tail call i32 @output_byte(i32 224)
ret void
}
float delta(float x) { return 0.0f == x ? 1.0f : 0.0f; }


x86 assembly (clang, -O0):
<delta>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm1
movss  0xeea(%rip),%xmm3
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
cmpeqss %xmm1,%xmm0
movaps %xmm0,%xmm1
andps  %xmm3,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<delta>:
xorps  %xmm1,%xmm1
cmpeqss %xmm1,%xmm0
movss  0xef0(%rip),%xmm1
andps  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @delta(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp oeq float 0.000000e+00, %3
%5 = zext i1 %4 to i64
%6 = select i1 %4, float 1.000000e+00, float 0.000000e+00
ret float %6
}

LLVM IR (-O2):
define float @delta(float %0) {
%2 = fcmp oeq float %0, 0.000000e+00
%3 = select i1 %2, float 1.000000e+00, float 0.000000e+00
ret float %3
}
/* Type definitions */
struct process {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ process_exit(struct process *const);
void autostart_exit(struct process *const processes[]) {
  int i;
  for (i = 0; processes[i] != 0; ++i) {
    process_exit(processes[i]);
    ;
  }
}


x86 assembly (clang, -O0):
<autostart_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1155 <autostart_exit+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <process_exit@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <autostart_exit+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<autostart_exit>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1131 <autostart_exit+0x21>
add    $0x8,%rbx
call   1030 <process_exit@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <autostart_exit+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.process = type { i32 }
define void @autostart_exit(%struct.process** nocapture %0) {
%2 = load %struct.process*, %struct.process** %0
%3 = icmp eq %struct.process* %2, null
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi %struct.process* [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @process_exit(%struct.process* %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds %struct.process*, %struct.process** %0, i64 %8
%10 = load %struct.process*, %struct.process** %9
%11 = icmp eq %struct.process* %10, null
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
int test_imm_3Euint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x3E << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_3Euint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 62
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ printf(char *, int);
main(void) {
  int c;
  int i = 0;
  while ((c = getchar()) != '\n') {
    i++;
  }
  printf("Largo: %d\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
je     1157 <main+0x37>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    $0xa,%eax
jne    1130 <main+0x10>
lea    0xeba(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Largo: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %7, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
br label %4
10: ; preds = %4
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [11 x i8] c"Largo: %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i32 (...) @getchar()
%4 = icmp eq i32 %3, 10
%5 = add nuw nsw i32 %2, 1
br i1 %4, label %6, label %1
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
short msp430_offset(short insn) {
  short res = insn & 0x3ff;
  if (res & 0x200)
    res |= ~0x3ff;
  return res << 1;
}


x86 assembly (clang, -O0):
<msp430_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
and    $0x3ff,%eax
mov    %ax,-0x4(%rbp)
movswl -0x4(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
je     1137 <msp430_offset+0x37>
movswl -0x4(%rbp),%eax
or     $0xfffffc00,%eax
mov    %ax,-0x4(%rbp)
movswl -0x4(%rbp),%eax
shl    $0x1,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<msp430_offset>:
mov    %edi,%ecx
and    $0x3ff,%ecx
shl    $0x6,%edi
movswl %di,%eax
shr    $0xf,%eax
and    $0x7c00,%eax
or     %ecx,%eax
add    %eax,%eax
ret

LLVM IR (-O0):
define signext i16 @msp430_offset(i16 signext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = and i32 %5, 1023
%7 = trunc i32 %6 to i16
store i16 %7, i16* %3
%8 = load i16, i16* %3
%9 = sext i16 %8 to i32
%10 = and i32 %9, 512
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %1
%13 = load i16, i16* %3
%14 = sext i16 %13 to i32
%15 = or i32 %14, -1024
%16 = trunc i32 %15 to i16
store i16 %16, i16* %3
br label %17
17: ; preds = %12, %1
%18 = load i16, i16* %3
%19 = sext i16 %18 to i32
%20 = shl i32 %19, 1
%21 = trunc i32 %20 to i16
ret i16 %21
}

LLVM IR (-O2):
define signext i16 @msp430_offset(i16 signext %0) {
%2 = and i16 %0, 1023
%3 = and i16 %0, 512
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i16 0, i16 -1024
%6 = or i16 %5, %2
%7 = shl nsw i16 %6, 1
ret i16 %7
}
int system_print_screen_resolution_by_GTK(int argc, char *argv[]) { return 0; }


x86 assembly (clang, -O0):
<system_print_screen_resolution_by_GTK>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @system_print_screen_resolution_by_GTK(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main(void) {
  int a, b;
  a = 0;
  b = a + 8;
  printf("Direccion de memoria de a: %u\n", (unsigned int)&a);
  printf("Direccion de memoria de b: %u\n", (unsigned int)&b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x8,(%rsp)
lea    0x4(%rsp),%rsi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    %rsp,%rsi
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Direccion de memoria de a: %u\0A\00"
@.str.1 = [31 x i8] c"Direccion de memoria de b: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 8
store i32 %5, i32* %3
%6 = ptrtoint i32* %2 to i32
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = ptrtoint i32* %3 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Direccion de memoria de a: %u\0A\00"
@.str.1 = [31 x i8] c"Direccion de memoria de b: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %1
store i32 8, i32* %2
%5 = ptrtoint i32* %1 to i64
%6 = trunc i64 %5 to i32
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = ptrtoint i32* %2 to i64
%9 = trunc i64 %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ PF_PACKET;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int CreateRawSocket(int protocol_to_sniff) {
  int rawsock;
  if ((rawsock = socket(PF_PACKET, SOCK_RAW, htons(protocol_to_sniff))) == -1) {
    perror("Error creating raw socket: ");
    exit(-1);
  }
  return rawsock;
}


x86 assembly (clang, -O0):
<CreateRawSocket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <htons@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    %eax,%edx
call   1060 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    119a <CreateRawSocket+0x5a>
lea    0xe75(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateRawSocket>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ea6(%rip),%rax
mov    (%rax),%ebx
mov    0x2e8d(%rip),%rax
mov    (%rax),%ebp
call   1030 <htons@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1060 <socket@plt>
cmp    $0xffffffff,%eax
je     1171 <CreateRawSocket+0x31>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe88(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@PF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@.str = [28 x i8] c"Error creating raw socket: \00"
define i32 @CreateRawSocket(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @PF_PACKET
%5 = load i32, i32* @SOCK_RAW
%6 = load i32, i32* %2
%7 = call i32 @htons(i32 %6)
%8 = call i32 @socket(i32 %4, i32 %5, i32 %7)
store i32 %8, i32* %3
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@PF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@.str = [28 x i8] c"Error creating raw socket: \00"
define i32 @CreateRawSocket(i32 %0) {
%2 = load i32, i32* @PF_PACKET
%3 = load i32, i32* @SOCK_RAW
%4 = tail call i32 @htons(i32 %0)
%5 = tail call i32 @socket(i32 %2, i32 %3, i32 %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %1
ret i32 %5
}
float obdConvert_32(unsigned int A, unsigned int B, unsigned int C,
                    unsigned int D) {
  return ((float)A * 256.0f + (float)B) / 4.0f - 8192.0f;
}


x86 assembly (clang, -O0):
<obdConvert_32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2ss %rax,%xmm0
mov    -0x8(%rbp),%eax
cvtsi2ss %rax,%xmm1
movss  0xee0(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xecc(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xebc(%rip),%xmm1
subss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<obdConvert_32>:
mov    %edi,%eax
cvtsi2ss %rax,%xmm0
mov    %esi,%eax
cvtsi2ss %rax,%xmm1
mulss  0xeea(%rip),%xmm0
addss  %xmm1,%xmm0
mulss  0xee2(%rip),%xmm0
addss  0xede(%rip),%xmm0
ret

LLVM IR (-O0):
define float @obdConvert_32(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = uitofp i32 %9 to float
%11 = load i32, i32* %6
%12 = uitofp i32 %11 to float
%13 = call float @llvm.fmuladd.f32(float %10, float 2.560000e+02, float %12)
%14 = fdiv float %13, 4.000000e+00
%15 = fsub float %14, 8.192000e+03
ret float %15
}

LLVM IR (-O2):
define float @obdConvert_32(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = uitofp i32 %0 to float
%6 = uitofp i32 %1 to float
%7 = tail call float @llvm.fmuladd.f32(float %5, float 2.560000e+02, float %6)
%8 = fmul float %7, 2.500000e-01
%9 = fadd float %8, -8.192000e+03
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) { fprintf(stderr, "stat FILE...\n"); }


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"stat FILE...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"stat FILE...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct instance_data {
  int dummy;
};

/* Variables and functions */
int IRC_SendMessage(struct instance_data const *, char const *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int IRC_SendCTCPMessage(const struct instance_data *pID,
                        const char *szDestination, const char *szText) {
  char szBuffer[512];
  sprintf(szBuffer, "\x01%s\x01", szText);
  return IRC_SendMessage(pID, szDestination, szBuffer);
}


x86 assembly (clang, -O0):
<IRC_SendCTCPMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeb7(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x220(%rbp),%rdx
call   1030 <IRC_SendMessage@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IRC_SendCTCPMessage>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xec7(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <IRC_SendMessage@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.instance_data = type { i32 }
@.str = [5 x i8] c"\01%s\01\00"
define i32 @IRC_SendCTCPMessage(%struct.instance_data* %0, i8* %1, i8* %2) {
%4 = alloca %struct.instance_data*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [512 x i8]
store %struct.instance_data* %0, %struct.instance_data** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %6
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load %struct.instance_data*, %struct.instance_data** %4
%12 = load i8*, i8** %5
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%14 = call i32 @IRC_SendMessage(%struct.instance_data* %11, i8* %12, i8* %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.instance_data = type { i32 }
@.str = [5 x i8] c"\01%s\01\00"
define i32 @IRC_SendCTCPMessage(%struct.instance_data* %0, i8* %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = call i32 @IRC_SendMessage(%struct.instance_data* %0, i8* %1, i8* %5)
ret i32 %7
}
/* Variables and functions */
scalar_t__ malloc(int);
void bug_with_allocation_bad(int *x) {
  x = (int *)malloc(sizeof(int));
  int *y = NULL;
  *y = 42;
}


x86 assembly (clang, -O0):
<bug_with_allocation_bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x2a,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bug_with_allocation_bad>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>

LLVM IR (-O0):
define void @bug_with_allocation_bad(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
%4 = call i64 @malloc(i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %2
store i32* null, i32** %3
%6 = load i32*, i32** %3
store i32 42, i32* %6
ret void
}

LLVM IR (-O2):
define void @bug_with_allocation_bad(i32* nocapture readnone %0) {
%2 = tail call i64 @malloc(i32 4)
unreachable
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int append_file(int);
int get_random_existing_file_index();
bool test_append_file() {
  int32_t index = get_random_existing_file_index();
  if (index == -1) {
    return true;
  }
  return append_file(index);
}


x86 assembly (clang, -O0):
<test_append_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <get_random_existing_file_index@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1148 <test_append_file+0x28>
movl   $0x1,-0x4(%rbp)
jmp    1153 <test_append_file+0x33>
mov    -0x8(%rbp),%edi
call   1030 <append_file@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_append_file>:
push   %rax
xor    %eax,%eax
call   1040 <get_random_existing_file_index@plt>
cmp    $0xffffffff,%eax
je     1135 <test_append_file+0x15>
mov    %eax,%edi
pop    %rax
jmp    1030 <append_file@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test_append_file() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @get_random_existing_file_index()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 1, i32* %1
br label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = call i32 @append_file(i32 %8)
store i32 %9, i32* %1
br label %10
10: ; preds = %7, %6
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @test_append_file() {
%1 = tail call i32 (...) @get_random_existing_file_index()
%2 = icmp eq i32 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @append_file(i32 %1)
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ %4, %3 ], [ 1, %0 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = 1;
  if (fork() == 0) {
    printf("p1: x = %d\n", ++x);
  }
  printf("p2: x = %d\n", --x);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1050 <fork@plt>
cmp    $0x0,%rax
jne    116c <main+0x3c>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x8(%rbp)
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
add    $0xffffffff,%esi
mov    %esi,-0x8(%rbp)
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <fork@plt>
test   %rax,%rax
jne    1155 <main+0x25>
lea    0xeba(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x1,%ebx
lea    0xeb0(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"p1: x = %d\0A\00"
@.str.1 = [12 x i8] c"p2: x = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = call i64 (...) @fork()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %5, %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"p1: x = %d\0A\00"
@.str.1 = [12 x i8] c"p2: x = %d\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @fork()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2)
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ 1, %3 ], [ 0, %0 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int INT32_MIN;
int test_2(int ly) {
  if (INT32_MIN >= ly)
    ly = INT32_MIN + 1;
  return ly;
}


x86 assembly (clang, -O0):
<test_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2ed2(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jl     1128 <test_2+0x28>
mov    0x2ec0(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_2>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
lea    0x1(%rcx),%eax
cmp    %edi,%ecx
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
@INT32_MIN = global i32 0
define i32 @test_2(i32 %0) {
%2 = load i32, i32* @INT32_MIN
%3 = icmp slt i32 %2, %0
%4 = add nsw i32 %2, 1
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ Qt_setColor(char *, int, int, int, int);
void Qt_setColorBackground(char *widget, int r, int g, int b, int alpha) {
  (void)(widget);
  Qt_setColor("background", r, g, b, alpha);
}


x86 assembly (clang, -O0):
<Qt_setColorBackground>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xec3(%rip),%rdi
call   1030 <Qt_setColor@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"background\00"
define void @Qt_setColorBackground(i8* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @Qt_setColor(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sting_attack_checked(int, int);
int sting_get_next_attack(int attack_history) {
  if (!sting_attack_checked(attack_history, 0x1))
    return 0x1;
  if (!sting_attack_checked(attack_history, 0x4))
    return 0x4;
  return -1;
  if (!sting_attack_checked(attack_history, 0x2))
    return 0x2;
}


x86 assembly (clang, -O0):
<sting_get_next_attack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1030 <sting_attack_checked@plt>
cmp    $0x0,%eax
jne    113d <sting_get_next_attack+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    1166 <sting_get_next_attack+0x56>
mov    -0x8(%rbp),%edi
mov    $0x4,%esi
call   1030 <sting_attack_checked@plt>
cmp    $0x0,%eax
jne    115f <sting_get_next_attack+0x4f>
movl   $0x4,-0x4(%rbp)
jmp    1166 <sting_get_next_attack+0x56>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sting_get_next_attack>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x1,%ebx
mov    $0x1,%esi
call   1030 <sting_attack_checked@plt>
test   %eax,%eax
je     113b <sting_get_next_attack+0x2b>
mov    %ebp,%edi
mov    $0x4,%esi
call   1030 <sting_attack_checked@plt>
neg    %eax
sbb    %ebx,%ebx
or     $0x4,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @sting_get_next_attack(i32 %0) {
%2 = tail call i32 @sting_attack_checked(i32 %0, i32 1)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @sting_attack_checked(i32 %0, i32 4)
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 4, i32 -1
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
char *strnstr(char const *, char const *, size_t);
size_t strstrnlen(const char *string, const char *stop, size_t maxlen) {
  const char *end = strnstr(string, stop, maxlen);
  return end ? (size_t)(end - string) : maxlen;
}


x86 assembly (clang, -O0):
<strstrnlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strnstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1158 <strstrnlen+0x48>
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    1160 <strstrnlen+0x50>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strstrnlen>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <strnstr@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
test   %rax,%rax
cmove  %r14,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @strstrnlen(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i8* @strnstr(i8* %8, i8* %9, i64 %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %20
14: ; preds = %3
%15 = load i8*, i8** %7
%16 = load i8*, i8** %4
%17 = ptrtoint i8* %15 to i64
%18 = ptrtoint i8* %16 to i64
%19 = sub i64 %17, %18
br label %22
20: ; preds = %3
%21 = load i64, i64* %6
br label %22
22: ; preds = %20, %14
%23 = phi i64 [ %19, %14 ], [ %21, %20 ]
ret i64 %23
}

LLVM IR (-O2):
define i64 @strstrnlen(i8* %0, i8* %1, i64 %2) {
%4 = tail call i8* @strnstr(i8* %0, i8* %1, i64 %2)
%5 = icmp eq i8* %4, null
%6 = ptrtoint i8* %4 to i64
%7 = ptrtoint i8* %0 to i64
%8 = sub i64 %6, %7
%9 = select i1 %5, i64 %2, i64 %8
ret i64 %9
}
int test_untagged_typedef_enum(int val) { return val; }


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

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

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

LLVM IR (-O2):
define i32 @test_untagged_typedef_enum(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *prog) {
  fprintf(stderr,
          "Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] "
          "[ -t tick ]\n",
          prog);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [81 x i8] c"Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] [ -t tick ]\0A\00"
define void @usage(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 ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [81 x i8] c"Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] [ -t tick ]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int is_minute(int minuto) {
  if (minuto >= 0 && minuto < 60) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_minute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1127 <is_minute+0x27>
cmpl   $0x3c,-0x8(%rbp)
jge    1127 <is_minute+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <is_minute+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_minute>:
xor    %eax,%eax
cmp    $0x3c,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_minute(i32 %0) {
%2 = icmp ult i32 %0, 60
%3 = zext i1 %2 to i32
ret i32 %3
}
__attribute__((weak, section(".after_vectors"))) void IntDefaultHandler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<IntDefaultHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <IntDefaultHandler+0x9>
jmp    1109 <IntDefaultHandler+0x9>

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

LLVM IR (-O0):
define weak void @IntDefaultHandler() section ".after_vectors" {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define weak void @IntDefaultHandler() section ".after_vectors" {
br label %1
1: ; preds = %0, %1
br label %1
}