xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ eval_buffer(char *);
int /*<<< orphan*/ install_variable_buffer(char **, unsigned int *);
int /*<<< orphan*/ restore_variable_buffer(char *, unsigned int);
char *func_eval(char *o, char **argv,
                const char *funcname __attribute__((unused))) {
  char *buf;
  unsigned int len;
  install_variable_buffer(&buf, &len);
  eval_buffer(argv[0]);
  restore_variable_buffer(buf, len);
  return o;
}


x86 assembly (clang, -O0):
<func_eval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <install_variable_buffer@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <eval_buffer@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <restore_variable_buffer@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_eval>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1040 <install_variable_buffer@plt>
mov    (%rbx),%rdi
call   1050 <eval_buffer@plt>
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%esi
call   1030 <restore_variable_buffer@plt>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @func_eval(i8* %0, i8** %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%9 = call i32 @install_variable_buffer(i8** %7, i32* %8)
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @eval_buffer(i8* %12)
%14 = load i8*, i8** %7
%15 = load i32, i32* %8
%16 = call i32 @restore_variable_buffer(i8* %14, i32 %15)
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
define i8* @func_eval(i8* readnone returned %0, i8** nocapture %1, i8* nocapture readnone %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = bitcast i8** %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = call i32 @install_variable_buffer(i8** %4, i32* %5)
%9 = load i8*, i8** %1
%10 = call i32 @eval_buffer(i8* %9)
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = call i32 @restore_variable_buffer(i8* %11, i32 %12)
ret i8* %0
}
int getSize(int *array) {
  int i = 0;
  while (1) {
    if (array[i] == -1)
      return i;
    else
      i++;
  }
}


x86 assembly (clang, -O0):
<getSize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    1126 <getSize+0x26>
mov    -0xc(%rbp),%eax
pop    %rbp
ret
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <getSize+0xf>

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

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

LLVM IR (-O2):
define i32 @getSize(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, -1
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int detectPresence(char *);
scalar_t__ graphicMode();
int gxmessagePresent(void) {
  static int lGxmessagePresent = -1;
  if (lGxmessagePresent < 0) {
    lGxmessagePresent = detectPresence("gxmessage");
  }
  return lGxmessagePresent && graphicMode();
}


x86 assembly (clang, -O0):
<gxmessagePresent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f01(%rip)
jge    1147 <gxmessagePresent+0x27>
lea    0xec4(%rip),%rdi
call   1040 <detectPresence@plt>
mov    %eax,0x2ee9(%rip)
xor    %eax,%eax
cmpl   $0x0,0x2ee0(%rip)
mov    %al,-0x1(%rbp)
je     116a <gxmessagePresent+0x4a>
mov    $0x0,%al
call   1030 <graphicMode@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gxmessagePresent>:
push   %rax
mov    0x2f09(%rip),%eax
test   %eax,%eax
js     1143 <gxmessagePresent+0x23>
test   %eax,%eax
je     1159 <gxmessagePresent+0x39>
xor    %eax,%eax
call   1030 <graphicMode@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
lea    0xeb6(%rip),%rdi
call   1040 <detectPresence@plt>
mov    %eax,0x2edb(%rip)
test   %eax,%eax
jne    112f <gxmessagePresent+0xf>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@gxmessagePresent.lGxmessagePresent = internal global i32 -1
@.str = [10 x i8] c"gxmessage\00"
define i32 @gxmessagePresent() {
%1 = load i32, i32* @gxmessagePresent.lGxmessagePresent
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @detectPresence(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* @gxmessagePresent.lGxmessagePresent
br label %5
5: ; preds = %3, %0
%6 = load i32, i32* @gxmessagePresent.lGxmessagePresent
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = call i64 (...) @graphicMode()
%10 = icmp ne i64 %9, 0
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ false, %5 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
@gxmessagePresent.lGxmessagePresent = internal unnamed_addr global i32 -1
@.str = [10 x i8] c"gxmessage\00"
define i32 @gxmessagePresent() {
%1 = load i32, i32* @gxmessagePresent.lGxmessagePresent
%2 = icmp slt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @detectPresence(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* @gxmessagePresent.lGxmessagePresent
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ %4, %3 ], [ %1, %0 ]
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = tail call i64 (...) @graphicMode()
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %5
%13 = phi i32 [ 0, %5 ], [ %11, %8 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ b1_tx_empty(unsigned int);
int /*<<< orphan*/ b1outp(unsigned int, int, unsigned char);
void b1_put_byte(unsigned int base, unsigned char val) {
  while (!b1_tx_empty(base))
    ;
  b1outp(base, 0x01, val);
}


x86 assembly (clang, -O0):
<b1_put_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <b1_tx_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    114e <b1_put_byte+0x2e>
jmp    1153 <b1_put_byte+0x33>
jmp    1131 <b1_put_byte+0x11>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
movzbl -0x5(%rbp),%edx
call   1030 <b1outp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b1_put_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <b1_tx_empty@plt>
test   %eax,%eax
je     1130 <b1_put_byte+0x10>
movzbl %bpl,%edx
mov    %ebx,%edi
mov    $0x1,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <b1outp@plt>

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

LLVM IR (-O2):
define void @b1_put_byte(i32 %0, i8 zeroext %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @b1_tx_empty(i32 %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = tail call i32 @b1outp(i32 %0, i32 1, i8 zeroext %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help() {
  printf("format: bbfcreate posfile posnum negfile negnum\n");
}


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

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

LLVM IR (-O0):
@.str = [49 x i8] c"format: bbfcreate posfile posnum negfile negnum\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [48 x i8] c"format: bbfcreate posfile posnum negfile negnum\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
ret void
}
int c004(void) { return 0; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @c004() {
ret i32 0
}

LLVM IR (-O2):
define i32 @c004() {
ret i32 0
}
int leapyear(int year) {
  if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
    return 29;
  }
  return 28;
}


x86 assembly (clang, -O0):
<leapyear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    112f <leapyear+0x2f>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1143 <leapyear+0x43>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114f <leapyear+0x4f>
movl   $0x1d,-0x4(%rbp)
jmp    1156 <leapyear+0x56>
movl   $0x1c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leapyear>:
test   $0x3,%dil
sete   %al
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
cmp    $0x28f5c29,%edx
setae  %dl
and    %al,%dl
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
setb   %al
or     %dl,%al
movzbl %al,%eax
or     $0x1c,%eax
ret

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

LLVM IR (-O2):
define i32 @leapyear(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp ne i32 %4, 0
%6 = and i1 %3, %5
%7 = srem i32 %0, 400
%8 = icmp eq i32 %7, 0
%9 = or i1 %8, %6
%10 = select i1 %9, i32 29, i32 28
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void require(int e) {
  if (!e)
    exit(1);
}


x86 assembly (clang, -O0):
<require>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112f <require+0x1f>
mov    $0x1,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<require>:
test   %edi,%edi
je     1115 <require+0x5>
ret
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @require(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @require(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @exit(i32 1)
unreachable
5: ; preds = %1
ret void
}
int argc_of_argv(char **argv) {
  int count = 0;
  if (!argv)
    return 0;
  while (*(argv++))
    count++;
  return count;
}


x86 assembly (clang, -O0):
<argc_of_argv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1126 <argc_of_argv+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1158 <argc_of_argv+0x58>
jmp    112b <argc_of_argv+0x2b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
cmpq   $0x0,(%rax)
je     1152 <argc_of_argv+0x52>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <argc_of_argv+0x2b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<argc_of_argv>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <argc_of_argv+0x1c>
cmpq   $0x0,(%rdi)
je     111c <argc_of_argv+0x1c>
xor    %eax,%eax
nop
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <argc_of_argv+0x10>
ret

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

LLVM IR (-O2):
define i32 @argc_of_argv(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %10, %6 ], [ 0, %3 ]
%8 = phi i8** [ %9, %6 ], [ %0, %3 ]
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = add nuw nsw i32 %7, 1
%11 = load i8*, i8** %9
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %10, %6 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ fd_set_close_on_exec(int);
int open(char const *, int);
int open_cloexec(const char *pathname, int flags) {
  int fd = open(pathname, flags);
  if (fd >= 0)
    fd_set_close_on_exec(fd);
  return fd;
}


x86 assembly (clang, -O0):
<open_cloexec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1150 <open_cloexec+0x30>
mov    -0x10(%rbp),%edi
call   1030 <fd_set_close_on_exec@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_cloexec>:
push   %rbx
call   1040 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1133 <open_cloexec+0x13>
mov    %ebx,%edi
call   1030 <fd_set_close_on_exec@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @open_cloexec(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @open(i8* %0, i32 %1)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @fd_set_close_on_exec(i32 %3)
br label %7
7: ; preds = %5, %2
ret i32 %3
}
unsigned int __VERIFIER_nondet_uint(void) {
  unsigned int ui;
  { return (ui); }
}


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

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

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

LLVM IR (-O2):
define i32 @__VERIFIER_nondet_uint() {
ret i32 undef
}
/* Variables and functions */
int strlen(char *c) {
  int x = 0;
  while (*(c + x))
    x++;
  return x;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     112f <strlen+0x2f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ write_imm(int);
int /*<<< orphan*/ write_instr(int);
int scrllck_handler(char **save) {
  write_instr(0x00);
  write_imm(0x47);
  write_instr(0x28);
  return 0;
}


x86 assembly (clang, -O0):
<scrllck_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0x47,%edi
call   1030 <write_imm@plt>
mov    $0x28,%edi
call   1040 <write_instr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scrllck_handler>:
push   %rax
xor    %edi,%edi
call   1040 <write_instr@plt>
mov    $0x47,%edi
call   1030 <write_imm@plt>
mov    $0x28,%edi
call   1040 <write_instr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @scrllck_handler(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @write_instr(i32 0)
%4 = call i32 @write_imm(i32 71)
%5 = call i32 @write_instr(i32 40)
ret i32 0
}

LLVM IR (-O2):
define i32 @scrllck_handler(i8** nocapture readnone %0) {
%2 = tail call i32 @write_instr(i32 0)
%3 = tail call i32 @write_imm(i32 71)
%4 = tail call i32 @write_instr(i32 40)
ret i32 0
}
/* Variables and functions */
double cosh(double);
double exp(double);
double sqrt(int);
double tanh(double);
double ftrans(double x) {
  double val = tanh(x);
  return sqrt(1 + val * val) * 0.5 / (exp(0.5 * x) * cosh(x));
}


x86 assembly (clang, -O0):
<ftrans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <tanh@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe96(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  0xe79(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe68(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cosh@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftrans>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
call   1030 <tanh@plt>
mulsd  %xmm0,%xmm0
addsd  0xea6(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movapd %xmm0,%xmm1
movsd  0xe99(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mulsd  (%rsp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1040 <cosh@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @ftrans(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @tanh(double %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = load double, double* %3
%8 = call double @llvm.fmuladd.f64(double %6, double %7, double 1.000000e+00)
%9 = fptosi double %8 to i32
%10 = call double @sqrt(i32 %9)
%11 = fmul double %10, 5.000000e-01
%12 = load double, double* %2
%13 = fmul double 5.000000e-01, %12
%14 = call double @exp(double %13)
%15 = load double, double* %2
%16 = call double @cosh(double %15)
%17 = fmul double %14, %16
%18 = fdiv double %11, %17
ret double %18
}

LLVM IR (-O2):
define double @ftrans(double %0) {
%2 = tail call double @tanh(double %0)
%3 = tail call double @llvm.fmuladd.f64(double %2, double %2, double 1.000000e+00)
%4 = fptosi double %3 to i32
%5 = tail call double @sqrt(i32 %4)
%6 = fmul double %5, 5.000000e-01
%7 = fmul double %0, 5.000000e-01
%8 = tail call double @exp(double %7)
%9 = tail call double @cosh(double %0)
%10 = fmul double %8, %9
%11 = fdiv double %6, %10
ret double %11
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int openat(int, char const *, int, int /*<<< orphan*/);
extern int _swift_Glibc_openat(int fd, const char *path, int oflag,
                               mode_t mode) {
  return openat(fd, path, oflag, mode);
}


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

x86 assembly (clang, -O2):
<_swift_Glibc_openat>:
jmp    1030 <openat@plt>

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

LLVM IR (-O2):
define i32 @_swift_Glibc_openat(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @openat(i32 %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ FAIL(char const *);
int /*<<< orphan*/ foo();
scalar_t__ issetugid();
int main(int argc, const char *argv[]) {
  foo();
  if (issetugid())
    FAIL(argv[1]);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <issetugid@plt>
cmp    $0x0,%rax
je     116b <main+0x3b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <FAIL@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
call   1040 <foo@plt>
xor    %eax,%eax
call   1030 <issetugid@plt>
test   %rax,%rax
je     1150 <main+0x20>
mov    0x8(%rbx),%rdi
call   1050 <FAIL@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @foo()
%7 = call i64 (...) @issetugid()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @FAIL(i8* %12)
br label %14
14: ; preds = %9, %2
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @foo()
%4 = tail call i64 (...) @issetugid()
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @FAIL(i8* %8)
br label %10
10: ; preds = %6, %2
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
void emitX(char *name, int value) {
  printf("    static final int %s = 0x%x;\n", name, value);
}


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

x86 assembly (clang, -O2):
<emitX>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [33 x i8] c" static final int %s = 0x%x;\0A\00"
define void @emitX(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c" static final int %s = 0x%x;\0A\00"
define void @emitX(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int utf8rchr(char const *, char);
char *utf8_get_file_extension(char *ext, const char *filename) {
  int i;
  i = utf8rchr(filename, '.');
  if (i > 0)
    strcpy(ext, filename + i + 1);
  else
    *ext = 0;
  return ext;
}


x86 assembly (clang, -O0):
<utf8_get_file_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <utf8rchr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1168 <utf8_get_file_extension+0x48>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
jmp    116f <utf8_get_file_extension+0x4f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_get_file_extension>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    $0x2e,%esi
call   1040 <utf8rchr@plt>
test   %eax,%eax
jle    114f <utf8_get_file_extension+0x2f>
mov    %eax,%eax
lea    (%rbx,%rax,1),%rsi
add    $0x1,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
jmp    1153 <utf8_get_file_extension+0x33>
movb   $0x0,(%r14)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @utf8_get_file_extension(i8* returned %0, i8* %1) {
%3 = tail call i32 @utf8rchr(i8* %1, i8 signext 46)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = zext i32 %3 to i64
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = tail call i32 @strcpy(i8* %0, i8* %8)
br label %11
10: ; preds = %2
store i8 0, i8* %0
br label %11
11: ; preds = %10, %5
ret i8* %0
}
/* Type definitions */
struct value {
  int dummy;
};

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ malloc_error();
struct value *new_str(char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
struct value *new_str_copy(char *str) {
  int len = strlen(str);
  char *buf = malloc(len + 1);
  if (buf == NULL) {
    malloc_error();
  }
  strncpy(buf, str, len + 1);
  return new_str(buf);
}


x86 assembly (clang, -O0):
<new_str_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1189 <new_str_copy+0x39>
mov    $0x0,%al
call   1060 <malloc_error@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rdi
call   1070 <new_str@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_str_copy>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1177 <new_str_copy+0x27>
xor    %eax,%eax
call   1060 <malloc_error@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <new_str@plt>

LLVM IR (-O0):
%struct.value = type { i32 }
define %struct.value* @new_str_copy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 (...) @malloc_error()
br label %14
14: ; preds = %12, %1
%15 = load i8*, i8** %4
%16 = load i8*, i8** %2
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
%19 = call i32 @strncpy(i8* %15, i8* %16, i32 %18)
%20 = load i8*, i8** %4
%21 = call %struct.value* @new_str(i8* %20)
ret %struct.value* %21
}

LLVM IR (-O2):
%struct.value = type { i32 }
define %struct.value* @new_str_copy(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 (...) @malloc_error()
br label %8
8: ; preds = %6, %1
%9 = tail call i32 @strncpy(i8* %4, i8* %0, i32 %3)
%10 = tail call %struct.value* @new_str(i8* %4)
ret %struct.value* %10
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int _link_error(char const *message, int ret) {
  fputs("link"
        ": ",
        stderr);
  perror(message);
  return ret;
}


x86 assembly (clang, -O0):
<_link_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_link_error>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1030 <fputs@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"link: \00"
@stderr = global i32 0
define i32 @_link_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @perror(i8* %7)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
@.str = [7 x i8] c"link: \00"
@stderr = global i32 0
define i32 @_link_error(i8* nocapture %0, i32 returned %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @perror(i8* %0)
ret i32 %1
}
long max_long(int wsize) {
  if (wsize == 0)
    return 0;
  return (1 << (wsize - 1)) - 1;
}


x86 assembly (clang, -O0):
<max_long>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    111e <max_long+0x1e>
movq   $0x0,-0x8(%rbp)
jmp    1134 <max_long+0x34>
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_long>:
lea    -0x1(%rdi),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
xor    %ecx,%ecx
cmp    $0x1,%edi
not    %eax
cmovb  %ecx,%eax
cltq
ret

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

LLVM IR (-O2):
define i64 @max_long(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = add nsw i32 %0, -1
%4 = shl nsw i32 -1, %3
%5 = xor i32 %4, -1
%6 = select i1 %2, i32 0, i32 %5
%7 = sext i32 %6 to i64
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Entrance() { printf("Hello World!!!\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"Hello World!!!\0A\00"
define void @Entrance() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"Hello World!!!\00"
define void @Entrance() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
char *first_non_blank(char *from, char *to) {
  while (from < to && (*from == ' ' || *from == '\t')) {
    from++;
  }
  return from;
}


x86 assembly (clang, -O0):
<first_non_blank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x11(%rbp)
jae    114a <first_non_blank+0x4a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x12(%rbp)
je     1144 <first_non_blank+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115a <first_non_blank+0x5a>
jmp    116b <first_non_blank+0x6b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <first_non_blank+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<first_non_blank>:
mov    %rdi,%rax
cmp    %rsi,%rdi
jae    1127 <first_non_blank+0x27>
mov    %rsi,%rcx
sub    %rax,%rcx
jmp    111a <first_non_blank+0x1a>
add    $0x1,%rax
add    $0xffffffffffffffff,%rcx
je     1128 <first_non_blank+0x28>
movzbl (%rax),%edx
cmp    $0x20,%dl
je     1110 <first_non_blank+0x10>
cmp    $0x9,%dl
je     1110 <first_non_blank+0x10>
ret
mov    %rsi,%rax
ret

LLVM IR (-O0):
define i8* @first_non_blank(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %23, %2
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = icmp ult i8* %6, %7
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 32
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 9
br label %19
19: ; preds = %14, %9
%20 = phi i1 [ true, %9 ], [ %18, %14 ]
br label %21
21: ; preds = %19, %5
%22 = phi i1 [ false, %5 ], [ %20, %19 ]
br i1 %22, label %23, label %26
23: ; preds = %21
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %3
br label %5
26: ; preds = %21
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
define i8* @first_non_blank(i8* %0, i8* readnone %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = ptrtoint i8* %1 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = getelementptr i8, i8* %0, i64 %7
br label %9
9: ; preds = %4, %12
%10 = phi i8* [ %13, %12 ], [ %0, %4 ]
%11 = load i8, i8* %10
switch i8 %11, label %15 [
i8 32, label %12
i8 9, label %12
]
12: ; preds = %9, %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = icmp eq i8* %13, %8
br i1 %14, label %15, label %9
15: ; preds = %12, %9, %2
%16 = phi i8* [ %0, %2 ], [ %10, %9 ], [ %8, %12 ]
ret i8* %16
}
/* Variables and functions */
int /*<<< orphan*/ kprintf(char *, int);
void isrHandle9() { kprintf("ISR %d.\n", 9); }


x86 assembly (clang, -O0):
<isrHandle9>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x9,%esi
call   1030 <kprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrHandle9>:
lea    0xee9(%rip),%rdi
mov    $0x9,%esi
jmp    1030 <kprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle9() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 9)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle9() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 9)
ret void
}
/* Type definitions */
struct CLString {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLString_appendCharacter(struct CLString *, char);
void CLString_appendCString(struct CLString *self, char *theString) {
  while (*theString != '\0') {
    CLString_appendCharacter(self, *theString);
    theString += 1;
  }
}


x86 assembly (clang, -O0):
<CLString_appendCString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1151 <CLString_appendCString+0x41>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1030 <CLString_appendCharacter@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <CLString_appendCString+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CLString_appendCString>:
push   %r14
push   %rbx
push   %rax
mov    (%rsi),%al
test   %al,%al
je     1146 <CLString_appendCString+0x36>
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <CLString_appendCharacter@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <CLString_appendCString+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.CLString = type { i32 }
define void @CLString_appendCString(%struct.CLString* %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %10, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = tail call i32 @CLString_appendCharacter(%struct.CLString* %0, i8 signext %6)
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ XBAR1_IRQ_0_1_DriverIRQHandler();
__attribute__((weak)) void XBAR1_IRQ_0_1_IRQHandler(void) {
  XBAR1_IRQ_0_1_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @XBAR1_IRQ_0_1_IRQHandler() {
%1 = call i32 (...) @XBAR1_IRQ_0_1_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @XBAR1_IRQ_0_1_IRQHandler() {
%1 = tail call i32 (...) @XBAR1_IRQ_0_1_DriverIRQHandler()
ret void
}
int c2upper(c)
int c;
{ return ((c >= 'a' && c <= 'z') ? (c - ('a' - 'A')) : c); }


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

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

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

LLVM IR (-O2):
define i32 @c2upper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int callee_3(int, int, float);
int test_3(int first, int second, float third) {
  return callee_3(first, second, third);
}


x86 assembly (clang, -O0):
<test_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
call   1030 <callee_3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_3>:
jmp    1030 <callee_3@plt>

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

LLVM IR (-O2):
define i32 @test_3(i32 %0, i32 %1, float %2) {
%4 = tail call i32 @callee_3(i32 %0, i32 %1, float %2)
ret i32 %4
}
void fl(int *y) {
  char x;
  asm(""
      : "=@cc"
        "l"(x));
  if (!x)
    *y = 0;
}


x86 assembly (clang, -O0):
<fl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
setl   %al
mov    %al,-0x9(%rbp)
cmpb   $0x0,-0x9(%rbp)
jne    1122 <fl+0x22>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fl>:
jge    1103 <fl+0x3>
ret
movl   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @fl(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
%4 = call i8 asm "", "={@ccl},~{dirflag},~{fpsr},~{flags}"()
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = icmp ne i8 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = load i32*, i32** %2
store i32 0, i32* %8
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @fl(i32* nocapture writeonly %0) {
%2 = tail call i8 asm "", "={@ccl},~{dirflag},~{fpsr},~{flags}"()
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1
store i32 0, i32* %0
br label %5
5: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int xfork();
int fork_dont_care() {
  int pid = xfork();
  if (pid) {
    waitpid(pid, NULL, 0);
    return pid;
  } else if ((pid = xfork())) {
    exit(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<fork_dont_care>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <xfork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1165 <fork_dont_care+0x35>
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <waitpid@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118b <fork_dont_care+0x5b>
mov    $0x0,%al
call   1030 <xfork@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     117f <fork_dont_care+0x4f>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    1184 <fork_dont_care+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fork_dont_care>:
push   %rbx
xor    %eax,%eax
call   1030 <xfork@plt>
mov    %eax,%ebx
test   %eax,%eax
je     114b <fork_dont_care+0x1b>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <waitpid@plt>
jmp    1156 <fork_dont_care+0x26>
xor    %eax,%eax
call   1030 <xfork@plt>
test   %eax,%eax
jne    115a <fork_dont_care+0x2a>
mov    %ebx,%eax
pop    %rbx
ret
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i32 @fork_dont_care() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @xfork()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = load i32, i32* %2
%8 = call i32 @waitpid(i32 %7, i32* null, i32 0)
%9 = load i32, i32* %2
store i32 %9, i32* %1
br label %17
10: ; preds = %0
%11 = call i32 (...) @xfork()
store i32 %11, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %10
br label %16
16: ; preds = %15
store i32 0, i32* %1
br label %17
17: ; preds = %16, %6
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @fork_dont_care() {
%1 = tail call i32 (...) @xfork()
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @waitpid(i32 %1, i32* null, i32 0)
br label %10
5: ; preds = %0
%6 = tail call i32 (...) @xfork()
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %5, %3
ret i32 %1
}